Class: Netzke::Basepack::PagingForm
- Inherits:
-
Form::Base
- Object
- Netzke::Base
- Form::Base
- Netzke::Basepack::PagingForm
- Defined in:
- lib/netzke/basepack/paging_form.rb
Overview
A Form with paging toolbar. Allows browsing and editing records one-by-one.
Configuration
Besides Netzke::Form::Base 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 toActiveRecord::Relation#where). When it's a hash, it's a conditions hash (passed directly toActiveRecord::Relation#where). When it's an array, it's expanded into an SQL statement with arguments (passed directly toActiveRecord::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
Constant Summary
Constants included from Attributes
Attributes::ATTRIBUTE_METHOD_NAME
Instance Method Summary collapse
Methods inherited from Form::Base
#bbar, #configure_locked, #default_bbar, #js_record_data, #multiedit?
Methods included from DataAccessor
Methods included from Fields
#fields, #fields_from_items, #items
Methods included from Attributes
#apply_attribute_dsl, #association_attr?, #association_value_defaults, #attribute_overrides, #attributes, #augment_attribute_config
Methods included from Form::Services
Instance Method Details
#configure_bbar(c) ⇒ Object
44 45 46 47 |
# File 'lib/netzke/basepack/paging_form.rb', line 44 def (c) super c[:bbar] << :search end |
#configure_client(c) ⇒ Object
27 28 29 30 31 |
# File 'lib/netzke/basepack/paging_form.rb', line 27 def configure_client(c) super # Pass total records amount and the first record to the JS constructor c.total_records = total_records end |
#record ⇒ Object
override
23 24 25 |
# File 'lib/netzke/basepack/paging_form.rb', line 23 def record @record ||= model_adapter.first end |