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::NETZKE_ENDPOINTS

Instance Method Summary collapse

Methods inherited from McflyGridPanel

#augment_attribute_config, #configure

Methods inherited from Grid

#child_components, #class_can?, #configure, #configure_form_window, #get_json_sorter, #has_search_action?, #initialize, #linked_components

Methods included from Permissions

#can_call_endpoint?, #can_perform_action?, #can_perform_actions, #current_user_roles, extended, #has_any_perm?, #has_marty_permissions, #has_perm?

Constructor Details

This class inherits a constructor from Marty::Grid

Instance Method Details

#get_records(params) ⇒ Object



20
21
22
23
24
25
# File 'app/components/marty/live_search_grid_panel.rb', line 20

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