Class: Daru::View::DataTable
- Inherits:
-
Object
- Object
- Daru::View::DataTable
- Defined in:
- lib/daru/data_tables/data_table.rb,
lib/daru/data_tables/display/display.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#element_id ⇒ Object
Returns the value of attribute element_id.
-
#html_options ⇒ Object
Returns the value of attribute html_options.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(data = [], options = {}) ⇒ Object
constructor
Initializes the Daru::DataTables::DataTable object.
Methods included from JsHelpers
#draw_ajax_option, #draw_js, #draw_js_iruby, #extract_data_array, #set_callback_ajax
Methods included from ParamHelpers
Methods included from Display
#show_in_iruby, #show_script, #to_html, #to_js
Constructor Details
#initialize(data = [], options = {}) ⇒ Object
Returns Initializes the Daru::DataTables::DataTable object.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/daru/data_tables/data_table.rb', line 15 def initialize(data=[], ={}) @element_id = .delete(:element_id) unless [:element_id].nil? @html_options = .delete(:html_options) unless [:html_options].nil? @html_options ||= @data = data @options = @options[:data] = to_data_array(data) row_number = 0 @options[:data].each do |array| array.unshift(row_number) row_number += 1 end end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/daru/data_tables/data_table.rb', line 5 def data @data end |
#element_id ⇒ Object
Returns the value of attribute element_id.
5 6 7 |
# File 'lib/daru/data_tables/data_table.rb', line 5 def element_id @element_id end |
#html_options ⇒ Object
Returns the value of attribute html_options.
5 6 7 |
# File 'lib/daru/data_tables/data_table.rb', line 5 def @html_options end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/daru/data_tables/data_table.rb', line 5 def @options end |