Class: Netzke::Basepack::PagingFormPanel
- Inherits:
-
FormPanel
- Object
- Netzke::Base
- FormPanel
- 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) }
Instance Method Summary (collapse)
-
- (Object) js_config
Pass total records amount and the first record to the JS constructor.
-
- (Object) record
override.
Methods inherited from FormPanel
#bbar, #configuration, #configuration_components, property_fields
Methods included from DataAccessor
#assoc_and_assoc_method_for_column, #association_attr?, #combobox_options_for_column, #data_class, #normalize_attr, #normalize_attrs, #original_data_class, #primary_key_attr?, #set_default_virtual
Instance Method Details
- (Object) js_config
Pass total records amount and the first record to the JS constructor
26 27 28 29 30 31 |
# File 'lib/netzke/basepack/paging_form_panel.rb', line 26 def js_config super.merge({ :total_records => total_records, :record => record.to_hash(fields) }) end |
- (Object) record
override
21 22 23 |
# File 'lib/netzke/basepack/paging_form_panel.rb', line 21 def record @record ||= get_relation.first end |