Hi all,
I know i'm kinda pushing it by what I'm trying to accomplish here but it would
be cool if it would work.
Suppose I have following objects defined in my flowscript:
var topics = [
{
"title": "Product profile",
"id": "product_profile"
},
{
"title": "Pinning information",
"id": "pinning_information",
},
{
"title": "Limiting values",
"id": "limiting_values",
"type": "parametric",
}
];
What I would like to generate is something like:
<Topics>
<Topic id="product_profile" title="Product profile"/>
<Topic id="pinning_information" title="Pinning information"/>
<Topic id="limiting_values" title="Limiting values" type="parametric"/>
</Topics
So written in pseudo-code:
Iterate over all topics and generate a <topic> with it's corresponding
attributes. The only thing I don't know is if the forEach iterator also can
handle something like we can do to iterate over all keys of an object and then
retrieving the value.
for (var key in object) {
someFunction(key, object[key]);
}
<Topics>
<jx:forEach var="topic" items="${data.topics}">
<Topic>
<!--
<jx:forEach var="attribute" items="${topic}">
<jx:attribute name="${attribute}" value="${topic[attribute]}"/>
à this does not work because the @items does not seem to be able to handle the
wanted behaviour in case we don't pass on a collection but a javascript object.
In that case default behaviour should be in my opinion to iterate over the
keys of the object.
</jx:forEach>
-->
</Topic>
</jx:forEach>
</Topics>
What do you guys think?
Kind regards,
Robby