Sorting in Loop
Add <Sortings> under a loop element (e.g. <IterationBlock>, <ForEach>) to sort retrieved elements. <Sortings> contains one or more <Sorting>. Each <Sorting> defines a way to sort the elements retrieved. The following example show the use of <Sorting> in a template.
<Sortings>
<Sorting by="property" property="name"/>
</Sortings>
<Property property="name"/>
<ParagraphBreak/>
</IterationBlock>
Here is the outcome of the example above.
AccountController
AccountManager
Transaction
User
The following table lists the available attributes of <Sorting>.
|
|||||||||||||||||||||
Attributes of <Sorting> |
Suppress the default way of sorting
Without using <Sortings> and <Sorting>, elements in loop will still be sorted alphabetically. If you want to suppress the default way of sorting, write <Sortings noSort="true"/>. Here is an example:
<Sortings noSort="true"/>
<Property property="name"/>
<ParagraphBreak/>
</IterationBlock>
Related Resources
The following resources may help you to learn more about the topic discussed in this page.
5. Looping (Connector) | Table of Contents | 7. Conditional Expression |