Class: Netzke::Basepack::PagingFormPanel
- Defined in:
- lib/netzke/basepack/paging_form_panel.rb
Overview
A FormPanel with paging toolbar. Allows browsing and editing records one-by-one.
Configuration
Besides Netzke::Basepack::FormPanel
config options, accepts:
-
scope
- specifies how the data should be filtered. When it’s a symbol, it’s used as a scope name. When it’s a string, it’s a SQL statement (passed directly to ActiveRecord::Relation#where). When it’s a hash, it’s a conditions hash (passed directly to ActiveRecord::Relation#where). When it’s an array, it’s expanded into an SQL statement with arguments (passed directly to ActiveRecord::Relation#where), e.g.::scope => ["id > ?", 100])
When it’s a Proc, it’s passed the model class, and is expected to return an ActiveRecord::Relation, e.g.:
:scope => { |rel| rel.where(:id.gt => 100).order(:created_at) }
ToDo
-
Update the number of records after form submit
Instance Method Summary collapse
- #configure_bbar(c) ⇒ Object
-
#js_config ⇒ Object
Pass total records amount and the first record to the JS constructor.
-
#record ⇒ Object
override.
Methods inherited from FormPanel
#configuration, #configure_locked, #js_record_data
Methods included from DataAccessor
#association_attr?, #combobox_options_for_column, #data_adapter, #data_class, #normalize_attr, #normalize_attrs, #primary_key_attr?, #set_default_virtual
Instance Method Details
#configure_bbar(c) ⇒ Object
51 52 53 54 |
# File 'lib/netzke/basepack/paging_form_panel.rb', line 51 def (c) super c[:bbar] << :search.action end |
#js_config ⇒ Object
Pass total records amount and the first record to the JS constructor
30 31 32 33 34 |
# File 'lib/netzke/basepack/paging_form_panel.rb', line 30 def js_config super.merge({ :total_records => total_records }) end |
#record ⇒ Object
override
25 26 27 |
# File 'lib/netzke/basepack/paging_form_panel.rb', line 25 def record @record ||= data_adapter.first end |