ListModel.append "for" loop to add "attributes"?[SOLVED]
-
wrote on 29 Aug 2011, 05:27 last edited by
Hey All,
I know how to append a model with attributes element w/o issues using different values (below example is taken from manuals):
@fruitModel.append(..., "attributes":[{"name":"spikes","value":"7mm"},{"name":"color","value":"green"}]);@But in cases I need to run "for" loop cycle to append attributes section only I run into problems;(
How can I run a cycle like the below one but making the changes to one element's attributes and not adding attributes to each new list element created by the cycle (current effect of the code below) =( ??
@
for (var i=firstModel.count-1; i>=0; i--)
secondModel.append({"date": currentdate, "attributes":[{"parameter1":firstModel.get(i).name,"parameter2":firstModel.get(0).quantity}]})@
-
wrote on 29 Aug 2011, 05:52 last edited by
@secondModel.get(i).attributes.append(...)@
-
wrote on 29 Aug 2011, 14:16 last edited by
Thanks a lot for the tip! Solved now;)
1/3