         colEl.innerText = data
         colEl.style.left = @col_offset[j] + "px"
         colEl.style.top = "0"
-        colEl.style.width = @layout.column_width[j] - 1 + "px"
-        colEl.style.height = @layout.columnHeaderHeight + "px"
+        colEl.style.width = @layout.column_widths[j] - 1 + "px"
+        colEl.style.height = @layout.header_height + "px"
         @headerViewport.appendChild colEl
         @columns[j] = colEl
 

distance = (a1, a2)->
    Math.abs(a2-a1)

class TableView

    constructor: (container, @data, @layout)->

            @container = container
        @nb_cols = @data.nb_cols()
        @nb_rows = @data.nb_rows()
        @W = sum @layout.column_widths
        @row_height  = @layout.row_height
        @H = @layout.row_height * @nb_rows
        @col_offset = cumsum @layout.column_widths
        @min_col = Math.min.apply null, @layout.column_widths
        onDomReady = =>
            document.removeEventListener "DOMContentLoaded", arguments.callee, false
            @setup()
