Sha256: 4c72e4c9035485d038e891babfe2783b4a83035d41dc98d4b4a16f7b9c0e6f0a

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

module Netzke
  module Basepack
    class GridPanel < Netzke::Base
      class SearchWindow < Netzke::Basepack::Window

        action :search
        action :cancel
        action :clear, :icon => :application_form

        js_properties :title => "Advanced Search",
                      :width => "50%",
                      :auto_height => true,
                      :buttons => [:search.action, :cancel.action],
                      :tbar => [:clear.action]

        config :items => [js_component(:search_panel)]

        component :search_panel do
          {
            :class_name => "Basepack::SearchPanel",
            :model => config[:model],
            :items => config[:fields]
          }
        end

        js_method :on_clear, <<-JS
          function(){
            this.items.first().getForm().reset();
          }
        JS

        js_method :on_search, <<-JS
          function(){
            this.conditions = this.items.first().getForm().getValues();

            // do not send values of empty values
            for (var cond in this.conditions) {
              if (this.conditions[cond] == "") delete this.conditions[cond];
            }

            this.closeRes = 'OK';
            this.close();
          }
        JS

        js_method :on_cancel, <<-JS
          function(){
            this.closeRes = 'cancel';
            this.close();
          }
        JS

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
netzke-basepack-0.6.3 lib/netzke/basepack/grid_panel/search_window.rb
netzke-basepack-0.6.2 lib/netzke/basepack/grid_panel/search_window.rb
netzke-basepack-0.6.1 lib/netzke/basepack/grid_panel/search_window.rb