Defer the Creation of Child Components"

From Documentation
m (remove empty version history (via JWB))
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{ZKDevelopersGuidePageHeader}}
+
{{ZKDevelopersReferencePageHeader}}
  
For sophisticated pages, the performance can be improved if we defer the creation of child components until they are becoming visible. The simplest way to do it is by use of the <tt>fulfill</tt> attribute. In the following example, the children of the second tab panel are created only if it becomes visible. Refer to the '''Load on Demand''' section in the [http://books.zkoss.org/wiki/ZK_ZUML_Reference '''ZK User Interface Markup Language'''] chapter.
+
For sophisticated pages, the performance can be improved if we defer the creation of child components until they become visible. The simplest way to do this  is by the use of the <code>fulfill</code> attribute. In the following example, the children of the second tab panel are created only if it becomes visible.
  
<source lang="xml" >
+
<syntaxhighlight line lang="xml" >
 
<tabbox>
 
<tabbox>
 
     <tabs>
 
     <tabs>
Line 13: Line 13:
 
This panel is pre-loaded since no fulfill specified
 
This panel is pre-loaded since no fulfill specified
 
         </tabpanel>
 
         </tabpanel>
         <tabpanel fulfill="tab2.onSelect">
+
         <tabpanel fulfill="self.linkedTab.onSelect">
This panel is loaded only tab2 receives the onSelect event
+
This panel is loaded only if tab2 receives the onSelect event
 
         </tabpanel>
 
         </tabpanel>
 
     </tabpanels>
 
     </tabpanels>
 
</tabbox>
 
</tabbox>
</source>
+
</syntaxhighlight>
  
 +
For more information, please refer to the [[ZK Developer's Reference/UI Composing/ZUML/On-demand Evaluation|On-demand Evaluation]] section.
  
{{ ZKDevelopersGuidePageFooter}}
+
 
 +
 
 +
{{ ZKDevelopersReferencePageFooter}}

Latest revision as of 10:23, 5 February 2024


DocumentationZK Developer's ReferencePerformance TipsDefer the Creation of Child Components
Defer the Creation of Child Components


For sophisticated pages, the performance can be improved if we defer the creation of child components until they become visible. The simplest way to do this is by the use of the fulfill attribute. In the following example, the children of the second tab panel are created only if it becomes visible.

 1 <tabbox>
 2     <tabs>
 3         <tab label="Preload" selected="true"/>
 4         <tab id="tab2" label="OnDemand"/>
 5     </tabs>
 6     <tabpanels>
 7         <tabpanel>
 8 			This panel is pre-loaded since no fulfill specified
 9         </tabpanel>
10         <tabpanel fulfill="self.linkedTab.onSelect">
11 			This panel is loaded only if tab2 receives the onSelect event
12         </tabpanel>
13     </tabpanels>
14 </tabbox>

For more information, please refer to the On-demand Evaluation section.




Last Update : 2024/02/05

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.