Class: RubyMVC::Views::TableView
- Defined in:
- lib/ruby_mvc/views/table_view.rb
Overview
This class provides a basic TableView control based loosely on the Archistry JavaScript TreeGrid API. It requires that the data to be displayed be supplied as a TableModel instance.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from View
Instance Method Summary collapse
-
#initialize(model, options = {}, &block) ⇒ TableView
constructor
A new instance of TableView.
-
#load(model, options = {}, &block) ⇒ Object
This method is used to load the view with the information in the table model.
Methods inherited from View
create_widget, #method_missing, #peer, widget, widget_def
Constructor Details
#initialize(model, options = {}, &block) ⇒ TableView
Returns a new instance of TableView.
35 36 37 38 |
# File 'lib/ruby_mvc/views/table_view.rb', line 35 def initialize(model, = {}, &block) super(, &block) load(model, , &block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RubyMVC::Views::View
Instance Method Details
#load(model, options = {}, &block) ⇒ Object
This method is used to load the view with the information in the table model.
43 44 45 46 47 48 49 50 |
# File 'lib/ruby_mvc/views/table_view.rb', line 43 def load(model, = {}, &block) cols = columns(model, ) defw = "#{100 / cols.size}%" build_header(model, cols, defw, ) stack(:width => "100%") do model.each { |row| build_row(cols, row, defw) } end end |