Module: Netzke::Basepack::WrapLazyLoaded
- Included in:
- AccordionPanel, TabPanel
- Defined in:
- lib/netzke/basepack/wrap_lazy_loaded.rb
Overview
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.
Instance Method Summary collapse
Instance Method Details
#items ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/netzke/basepack/wrap_lazy_loaded.rb', line 8 def items orig = super.dup orig.each do |item| wrapped_component = components[item[:netzke_component]] # When a nested component with lazy loading is detected, it gets replaced with a 'fit' panel, # into which later the component itself is dynamically loaded on request. if wrapped_component && wrapped_component[:lazy_loading] item.replace({ :layout => 'fit', :wrapped_component => wrapped_component[:name], :title => wrapped_component[:title] || wrapped_component[:name], :icon_cls => wrapped_component[:icon_cls], :disabled => wrapped_component[:disabled] }) end end orig end |