forEachStatus"

From Documentation
m
m
Line 5: Line 5:
  
 
<source lang="xml" >
 
<source lang="xml" >
<zk>
+
<listbox width="100px">
  <listbox width="100px">
+
    <listitem label="${forEachStatus.index}: ${each}" forEach="Best, Better, Good"/>
    <listitem label="${forEachStatus.index}: ${each}" forEach="Best, Better, Good"/>
+
</listbox>
  </listbox>
 
</zk>
 
 
</source>
 
</source>
 
   
 
   
 
Note: <tt>forEachStatus.index</tt> is absolute with respect to the underlying collection, array or other type. For example, if <tt>forEachBegin</tt> is <tt>5</tt>, then the first value of <tt>forEachStatus.index</tt> with be <tt>5</tt>.
 
Note: <tt>forEachStatus.index</tt> is absolute with respect to the underlying collection, array or other type. For example, if <tt>forEachBegin</tt> is <tt>5</tt>, then the first value of <tt>forEachStatus.index</tt> with be <tt>5</tt>.
 +
 +
To retrieve the information of the outer iterator if an iteration is nested, you could use <javadoc method="getPrevious()" type="interface">org.zkoss.zk.ui.util.ForEachStatus</javadoc>.
 +
 +
<source lang="xml">
 +
<listbox forEach="${matrix}">
 +
    <listitem label="${forEachStatus.previous.each.label}: ${each}" forEach=${each.items}/> <!-- nexted -->
 +
</listbox>
 +
</source>
  
 
==Version History==
 
==Version History==

Revision as of 07:24, 15 November 2010

forEachStatus – org.zkoss.zk.ui.util.ForEachStatus

The status of an iteration. It is an instance of ForEachStatus. ZK exposes the information relative to the iteration taking place when evaluating the iterative element.

<listbox width="100px">
    <listitem label="${forEachStatus.index}: ${each}" forEach="Best, Better, Good"/>
</listbox>

Note: forEachStatus.index is absolute with respect to the underlying collection, array or other type. For example, if forEachBegin is 5, then the first value of forEachStatus.index with be 5.

To retrieve the information of the outer iterator if an iteration is nested, you could use ForEachStatus.getPrevious().

<listbox forEach="${matrix}">
    <listitem label="${forEachStatus.previous.each.label}: ${each}" forEach=${each.items}/> <!-- nexted -->
</listbox>

Version History

Version Date Content
     



Last Update : 2010/11/15

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