I would like to read some values from my vm. Here's an example of what I've done so far
<div forEach="${vm.activityData.activityList}">
<label
value="@load(c:cat3('vm.activitiData.', each, '.organizer' ))" />
</div>
But it seems like it is unable to read the each
inside the cat3
. My objective is to get the organizer for each activity. Any idea how to achieve this ?
Update
For example, I want to simplify from this codes :
<div>
<label value="@load(vm.activityData.A.name)" />
<label value="@load(vm.activityData.ASponsor)" />
<label value="@load(vm.activityData.AOrganizer)" />
<separator/>
<label value="@load(vm.activityData.B.name)" />
<label value="@load(vm.activityData.BSponsor)" />
<label value="@load(vm.activityData.BOrganizer)" />
<separator/>
</div>
into
<div forEach="${vm.activityData.activityList}">
<label value="@load(c:cat3('vm.activityData.', each, '.name'))" />
<label value="@load(c:cat3('vm.activityData.', each, 'Sponsor'))" />
<label value="@load(c:cat3('vm.activityData.', each, 'Organizer'))" />
<separator/>
</div>
Basically what I want to do is to dynamically combine part of strings into one string. And then use @load(string)
.
Today I had the time to test it and I prepared a fiddle for you.
Your ZK version is good but I did forget to add one more thing.
You have to make use of the
custom-attributes
otherwise it wouldn't work.Solution :
I created fast a working fiddle where you can test or look how it works.