Class: Marty::LiveSearchGridPanel

Inherits:
McflyGridPanel show all
Defined in:
app/components/marty/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. NOTE: this is rewrite of the Netzke community pack component of the same name. We should submit this to the community.

Options:

  • live_search_scope - The scope name for filtering the results by the live search (default: :live_search)

Constant Summary

Constants included from Permissions

Permissions::ALL_ROLES, Permissions::REQ_ROLES

Instance Method Summary collapse

Methods inherited from McflyGridPanel

#augment_attribute_config, #configure

Methods inherited from Grid

#class_can?, #configure, #configure_form_window, #get_json_sorter, #has_search_action?

Methods included from Permissions

#can_perform_action?, #can_perform_actions, #current_user_roles, #has_any_perm?, #has_marty_permissions

Instance Method Details

#get_records(params) ⇒ Object



40
41
42
43
44
45
# File 'app/components/marty/live_search_grid_panel.rb', line 40

def get_records(params)
  search_scope = config[:live_search_scope] || :live_search
  model.send(search_scope, params && params[:live_search] || '').scoping do
    super
  end
end