Sha256: 8e4f181fb079974dd53436e30a45c4b6ec06f72f04e840bac65373c4746c333c

Contents?: true

Size: 1.36 KB

Versions: 9

Compression:

Stored size: 1.36 KB

Contents

module Netzke
  module Basepack
    # = AccordionPanel
    #
    # A panel with the 'accordion' layout. Can lazily load its nested components. For example:
    #
    #     netzke :my_accordion, :items => [{
    #         :html => "I'm a simple Ext.Panel",
    #         :title => "Panel One"
    #       },{
    #         :class_name => "SimplePanel",
    #         :update_text => "Update for Panel Two",
    #         :title => "Panel Two",
    #         :lazy_loading => true
    #       }]
    class AccordionPanel < Netzke::Base

      include WrapLazyLoaded

      js_property :layout, 'accordion'
      js_property :component_load_mask, {:msg => null} # due to a probable bug in Ext's Accordion Layout (mask message is mis-layed-out), disabling mask message

      js_method :init_component, <<-JS
        function(params){
          #{js_full_class_name}.superclass.initComponent.call(this);
          this.items.each(function(item){
            item.on('expand', function(i){
              if (i && i.wrappedComponent && !i.items.first() && !i.beingLoaded) {
                i.beingLoaded = true; // prevent more than one request per panel in case of fast clicking
                this.loadNetzkeComponent({name: i.wrappedComponent, container: i.id}, function(){i.beingLoaded = false});
              }
            }, this);
          }, this);
        }
      JS

    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
netzke-basepack-0.7.7 lib/netzke/basepack/accordion_panel.rb
netzke-basepack-zh-0.7.6 lib/netzke/basepack/accordion_panel.rb
netzke-basepack-0.7.6 lib/netzke/basepack/accordion_panel.rb
netzke-basepack-0.7.5 lib/netzke/basepack/accordion_panel.rb
netzke-basepack-0.7.4 lib/netzke/basepack/accordion_panel.rb
netzke-basepack-0.7.3 lib/netzke/basepack/accordion_panel.rb
netzke-basepack-0.7.2 lib/netzke/basepack/accordion_panel.rb
netzke-basepack-0.7.1 lib/netzke/basepack/accordion_panel.rb
netzke-basepack-0.7.0 lib/netzke/basepack/accordion_panel.rb