tableView = Luca.register "Luca.components.TableView" tableView.extends "Luca.components.CollectionView" tableView.publicConfiguration widths: [] columns:[] emptyText: "There are no results to display" tableView.privateConfiguration additionalClassNames: "table" tagName: "table" bodyTemplate: "table_view" bodyTagName: "tbody" bodyClassName: "table-body" stateful: true itemTagName: "tr" observeChanges: true tableView.privateMethods eachColumn: (fn, scope=@)-> index = 0 for col in @columns fn.call(scope, col, index++, @) itemRenderer: (item, model)-> Luca.components.TableView.rowRenderer.call(@, item, model) initialize: (@options={})-> Luca.components.CollectionView::initialize.apply(@, arguments) index = 0 @columns = for column in @columns if width = @widths[ index ] column.width = width if _.isString(column) column = reader: column if !column.header? column.header = _.str.titleize(_.str.humanize(column.reader)) index++ column @defer ()=> Luca.components.TableView.renderHeader.call(@, @columns, @$('thead') ) .until("after:render") tableView.classMethods renderHeader : (columns, targetElement)-> index = 0 @$( targetElement ).append("