Sha256: 16e2bf8c98af68886f247591706c3cd3a014eb1b9405ec0cb73551ae8174cd93

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 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_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.wrappedComponent && !i.items.first()) {
                this.loadComponent({name: i.wrappedComponent, container: i.id});
              }
            }, this);
          }, this);
        }
      JS
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
netzke-basepack-0.6.0 app/components/netzke/basepack/accordion_panel.rb