lib/trestle/table.rb in trestle-0.8.6 vs lib/trestle/table.rb in trestle-0.8.7

- old
+ new

@@ -7,20 +7,22 @@ autoload :Column autoload :ActionsColumn autoload :SelectColumn autoload :Row - attr_reader :columns, :options, :admin + attr_reader :columns, :options attr_writer :row def initialize(options={}) @options = options - @admin = Trestle.lookup(options[:admin]) if options.key?(:admin) - @columns = [] end + def admin + Trestle.lookup(options[:admin]) if options.key?(:admin) + end + def sortable? options[:sortable] == true end def autolink? @@ -45,10 +47,14 @@ def row @row ||= @table.row.renderer(@template) end def columns - @columns ||= @table.columns.map { |column| column.renderer(@template) } + @columns ||= row.columns + end + + def id + options[:id] end def classes ["trestle-table", options[:class]].compact end