Sha256: 8c351541b3dd2c98c94b585b53028487d3aefa8e312df51a2bda03345503e5e0

Contents?: true

Size: 1.49 KB

Versions: 28

Compression:

Stored size: 1.49 KB

Contents

# 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)
#

class Marty::LiveSearchGridPanel < Marty::McflyGridPanel
  js_configure do |c|
    c.listen_fn = <<-JS
    function(obj, search_text) {
        var lg = this.ownerCt.ownerCt;
        lg.getStore().getProxy().extraParams.live_search = search_text;
        lg.getStore().load();
    }
    JS

    c.tbar = ['->', {
                name:  'live_search_text',
                xtype: 'textfield',
                enable_key_events: true,
                ref: '../live_search_field',
                empty_text: 'Search',
                listeners: {
                  change: {
                    fn: c.listen_fn,
                    buffer: 100,
                  }
                }
              }]
  end

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

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
marty-0.5.41 app/components/marty/live_search_grid_panel.rb
marty-0.5.40 app/components/marty/live_search_grid_panel.rb
marty-0.5.39 app/components/marty/live_search_grid_panel.rb
marty-0.5.38 app/components/marty/live_search_grid_panel.rb
marty-0.5.36 app/components/marty/live_search_grid_panel.rb
marty-0.5.35 app/components/marty/live_search_grid_panel.rb
marty-0.5.34 app/components/marty/live_search_grid_panel.rb
marty-0.5.33 app/components/marty/live_search_grid_panel.rb
marty-0.5.32 app/components/marty/live_search_grid_panel.rb
marty-0.5.31 app/components/marty/live_search_grid_panel.rb
marty-0.5.30 app/components/marty/live_search_grid_panel.rb
marty-0.5.29 app/components/marty/live_search_grid_panel.rb
marty-0.5.28 app/components/marty/live_search_grid_panel.rb
marty-0.5.27 app/components/marty/live_search_grid_panel.rb
marty-0.5.26 app/components/marty/live_search_grid_panel.rb
marty-0.5.25 app/components/marty/live_search_grid_panel.rb
marty-0.5.24 app/components/marty/live_search_grid_panel.rb
marty-0.5.23 app/components/marty/live_search_grid_panel.rb
marty-0.5.21 app/components/marty/live_search_grid_panel.rb
marty-0.5.20 app/components/marty/live_search_grid_panel.rb