I'm slowly starting to get the hang of EmberJS. Unfortunately I've run into an issue I can't seem to work out.
I have a complex data-structure, which I retrieve through JSON, with multiple nested arrays and I can't seem to nest #each helpers.
I've setup my template as follows (shortened):
{{#each Servers}}
<div class="server">
<h1>{{unbound Name}}</h1>
Time: {{jsonDate CurrentTime}}<br />
<table>
{{#each Processes}}
<tr>
<td>{{unbound Name}}</td>
<td>{{unbound Location}}</td>
</tr>
{{/each}}
</table>
</div>
{{#/each}}
The second loop doesn't seem to run, when I modify Ember to log a message, #the second each is called, but it seems it doesn't know what to do.
When I replace the second #each with #Queue, it works, but right before the -element an "undefined"-text is inserted for every element in the list (minus 1).
When I move the #each outside of the other loop and put in the direct path to Queue (eg. Servers.0.Queue) it works fine, so it's certainly not the data.
How do I fix this? If nested #each is not possible, how do I prefend the "undefined"-text for the other method? Any other possibilities?
PS. I use unbound for performance reasons, I update the Servers object in one go and observe that, so there is no need to use bound properties - as I've noticed it significantly reduces browser performance (13% CPU Usage, whereas unbound gave me 0%). Not sure if related.
EDIT
Please see: http://jsfiddle.net/PTC9B/7/
The ServerOverview2a-method works after all, apparently ServerOverview2b generates the "undefined"-text I described earlier - probably should file a bug report for that?
My question now is: Why do nested #each not work whereas #Processes does?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…