Class: Netzke::Communitypack::LiveSearchGridPanel
- Inherits:
-
Basepack::GridPanel
- Object
- Basepack::GridPanel
- Netzke::Communitypack::LiveSearchGridPanel
- Defined in:
- lib/netzke/communitypack/live_search_grid_panel.rb
Overview
The LiveSearchGridPanel provides a search field in the toolbar of the GridPanel. While the content of the search field is changeing, the data in the grid gets reloaded and the filter string is given to a scope on the configured model. The scope name by default is :live_search but it can be reconfigured by the configuration option :live_search_scope.
Options:
-
live_search_scope
- The scope name for filtering the results by the live search (default: :live_search)
Instance Method Summary collapse
Instance Method Details
#configuration ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/netzke/communitypack/live_search_grid_panel.rb', line 10 def configuration super.merge({ :tbar => ['->', { :xtype => 'textfield', :enable_key_events => true, :ref => '../live_search_field', :empty_text => 'Search' }] }) end |
#get_data(*args) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/netzke/communitypack/live_search_grid_panel.rb', line 41 def get_data(*args) params = args.first search_scope = config[:live_search_scope] || :live_search data_class.send(search_scope, params && params[:live_search] || '').scoping do super end end |