Class: Gridify::Grid
- Inherits:
-
Object
- Object
- Gridify::Grid
- Includes:
- Assertions
- Defined in:
- lib/gridify/grid.rb,
lib/gridify/grid_view.rb,
lib/gridify/grid_finder.rb,
lib/gridify/grid_options.rb
Instance Attribute Summary collapse
-
#search_rules ⇒ Object
current search/filter rules, as hash.
-
#search_rules_op ⇒ Object
current search/filter rules, as hash.
Instance Method Summary collapse
-
#arranger_options(type) ⇒ Object
read-only.
-
#arranger_type ⇒ Object
read-only.
- #collapsible ⇒ Object
- #column(name, options = {}) ⇒ Object
- #column_model ⇒ Object
- #column_names ⇒ Object
-
#columns_hash ⇒ Object
normally we need to keep columns an ordered array, sometimes its convenient to have a hash.
-
#current_scope ⇒ Object
return find args (scope) for current settings.
- #data_format ⇒ Object
- #data_type ⇒ Object
- #dom_id ⇒ Object
- #encode_records(records, total_count = nil) ⇒ Object
- #error_container ⇒ Object
- #error_handler ⇒ Object
- #error_handler_return_value ⇒ Object
- #find(params) ⇒ Object
- #find_and_encode(params) ⇒ Object
- #finder ⇒ Object
-
#initialize(klass, *args, &block) ⇒ Grid
constructor
todo: change this so klass is optional, decouple from active record.
- #jqgrid_options ⇒ Object
-
#member_params(params) ⇒ Object
grid doesnt nest attributes inside the resource could change this behavior in jqGrid, see grid.postext.js ? http://www.trirand.com/jqgridwiki/doku.php?id=wiki:post_data_module.
-
#pager ⇒ Object
pager layer.
- #paging_choices ⇒ Object
- #paging_controls ⇒ Object
- #resizable ⇒ Object
-
#restful ⇒ Object
---------------------- attribute defaults and special value handling (sure it'd be easier to initialize defaults using a hash but we want nil to mean the jqGrid default - might be true - and not pass a value at all).
- #rows_per_page ⇒ Object
- #searchable ⇒ Object
- #select_rows ⇒ Object
- #sortable ⇒ Object
-
#title ⇒ Object
header layer.
-
#to_javascript(options = {}) ⇒ Object
---------------------- generate the grid javascript for a view options: :script => true generates
todo: change this so klass is optional, decouple from active record
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
# File 'lib/gridify/grid.rb', line 14 def initialize( klass, *args, &block ) #debugger = args. # => args.last.is_a?(Hash) ? args.pop : {} assert_exclusive_keys( , :only, :except) @resource = klass.to_s.tableize.pluralize @name = args.first || :grid # non-persistent options # generate model unless explicitly say no build_model = .delete(:build_model) == false ? false : true only = .delete(:only) except = .delete(:except) col_presets = .delete(:columns) # assign options update # build columns from ActiveRecord model (klass) if klass.present? && build_model @model = build_columns klass, only, except, col_presets end instance_eval(&block) if block #(note instance_eval cannot access things outside its scope; otherwise do this: #yield self if block_given? end