Methods

Netzke::Basepack::WrapLazyLoaded

Include this module into your component component class when you want lazy-loaded component in config to be auto-replaced with a panel with the ‘fit’ layout, and a property wrappedComponent set to the name of the original component. Used, for instance, in TabPanel and AccordionPanel to dynamically load components on expanding a panel or clicking a tab.

Public Instance Methods

items() click to toggle source
    # File lib/netzke/basepack/wrap_lazy_loaded.rb, line 8
 8:       def items
 9:         orig = super.dup
10:         orig.each do |item|
11:           wrapped_component = components[item[:component]]
12:           # When a nested component with lazy loading is detected, it gets replaced with a 'fit' panel,
13:           # into which later the component itself is dynamically loaded on request.
14:           if wrapped_component && wrapped_component[:lazy_loading]
15:             item.replace({
16:               :layout => 'fit',
17:               :wrapped_component => wrapped_component[:name],
18:               :title => wrapped_component[:title] || wrapped_component[:name],
19:               :icon_cls => wrapped_component[:icon_cls],
20:               :disabled => wrapped_component[:disabled]
21:             })
22:           end
23:         end
24:         orig
25:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.