...
The groupList header allows a sequence to be ordered by creating virtual groups. By placing this macro in the groupList content, it is possible, when browsing the ordered sequence, to detect when the current element is the first element in a group, in order to execute the nested content of this macro.
This macro can be used to display information on the current group (its title for example) before displaying the content of the current element.
When browsing the ordered sequence, the nested content of this macro will only be executed once per group: when the current element is the first in the group.
For example
Pas de format |
---|
<#assign seqData = [{"name": "mary", "age": 18}, {"name": "Lucy", "age": 19}, {"name": "Mark", "age": 19}, {"name": "Charlie", "age": 17}, {"name": "Aaron", "age": 18}, {"name": "Tess", "age": 16}, {"name": "Isaac", "age": 16} ]/><#assign> <#assign orderingCriteria = {"name": "original_order_by_age", "colName": "age", "order":"o"} /><@hardisAdv> <@hardisAdv.groupList .data_model.seqData orderingCriteria; aPerson><@hardisAdvaPerson> <@hardisAdv.groupHeader "original_order_by_age">Here> Here is a new age group: </@hardisAdv.groupHeader>$groupHeader> ${ aPerson.name} has ${ aPerson.age } </@hardisAdv.groupList> |
...
has the result:
Here is a new age group:
...
Here is a new age group:
Tess is 16
Isaac is 16
...
Information can be accessed from the current element group by passing a loop variable to the macro which will be supplied by it and can be used in its nested content. This variable is a Hash object which groups information on the group via the following attributes:
...
Pas de format |
---|
<#assign seqData = [{"name": "mary", "age": 18}, {"name": "Lucy", "age": 19}, {"name": "Mark", "age": 19}, {"name": "Charlie", "age": 17}, {"name": "Aaron", "age": 18}, {"name": "Tess", "age": 16}, {"name": "Isaac", "age": 16} ]/><#assign> <#assign orderingCriteria = {"name": "original_order_by_age", "colName": "age", "order":"o"} /><@hardisAdv> <@hardisAdv.groupList .data_model.seqData orderingCriteria; aPerson><@hardisAdvaPerson> <@hardisAdv.groupHeader "original_order_by_age"; infoGroupOriginalOrderByAge>GroupinfoGroupOriginalOrderByAge> Group of ${ infoGroupOriginalOrderByAge .label}: ${ infoGroupOriginalOrderByAge .endRow - infoGroupOriginalOrderByAge .startRow } people<people </@hardisAdv.groupHeader>$groupHeader> ${ aPerson.name} has ${ aPerson.age } </@hardisAdv.groupList> |
has the result:
Group of 18: 1 people
...
Isaac is 16
Empty directive: No
Parameters
Hardis - Tableau personnalisé | ||||
---|---|---|---|---|
| ||||
|
For example
Pas de format |
---|
<@hardisAdv.groupList .data_model.seqItems orderingCriteria; aItem><@hardisAdvaItem> <@hardisAdv.groupHeader "orderGroup1"; infoGroup>BeginninginfoGroup> Beginning of group ${ infoGroup.label } </@hardisAdv.groupHeader> ... ${ aItem.fooAttribute} ... <@hardisAdv.groupFooter "orderGroup1"; infoGroup>EndinfoGroup> End of group ${ infoGroup.label } </@hardisAdv.groupFooter><groupFooter> </@hardisAdv.groupList> |
Hardis - Haut de page |
---|
↑ Top of page |