Netzke::AccordionPanel

Features:
  • Dynamically loads the nested widget when a panel gets expanded for the first time
  • Is loaded along with the "active" widget - saves a request to the server
  • Example: two GridPanels loaded dynamically

    A two-panel accordion, where panels, at the moment of being expanded, dynamically load two differently configured GridPanels.

    Code:

    netzke :two_grid_panels,
              :class_name => "AccordionPanel",
              :items => [{
                :class_name => "GridPanel",
                :model => "Boss",
                :name => "bosses"
              }, {
                :class_name => "GridPanel",
                :model => "Clerk",
                :name => "clerks"
              }], 
              :ext_config => {
                :width => 700,
                :title => "Two GridPanels loaded dynamically"
              } 
    

    Result:

    Example: a GridPanel and a FormPanel, preloaded

    A two-panel accordion nesting a GridPanel and a FormPanel, which get loaded along with the accordion (no dynamic loading takes place)

    Code:
    netzke :accordion_panel, 
              :items => [{
                :class_name => "GridPanel",
                :model => "Boss",
                :name => "bosses",
                :preloaded => true
              }, {
                :class_name => "FormPanel",
                :model => "Clerk",
                :name => "clerks",
                :preloaded => true,
                :record_id => Clerk.first.id
              }], 
              :ext_config => {
                :width => 700,
                :title => "GridPanel and FormPanel - preloaded",
                :border => true
              } 
    
    Result:

    Example: a Panel and a BorderLayoutPanel, where the former is active

    The accordion gets loaded with the first panel being "active", i.e. pre-loaded and open. The second panel is a BorderLayoutPanel with two panels - a grid and a form

    Code:

    netzke :border_layout_panel_active,
              :class_name => "AccordionPanel",
              :items => [{
                :class_name => "Panel",
                :ext_config => {
                  :html => "The first panel is active"
                },
                :active => true
              },{
                :class_name => "BorderLayoutPanel",
                :regions => {
                  :center => {
                    :class_name => "GridPanel",
                    :model => "Boss"
                  },
                  :south => {
                    :class_name => "FormPanel",
                    :model => "Clerk",
                    :record_id => Clerk.first.id,
                    :region_config => {
                      :height => 150
                    }
                  }
                }
              }],
              :ext_config => {
                :width => 700,
                :border => true
              }
    

    Result: