I am constructing a task app ( For fun) & i just sat down thinking about this problem. I will put the question on my mind in words here.
Model is extremely simple, it contains collection of Project. Each Project contains a TaskList these TaskList is nestable i.e for example a Task Design FrontPage can have Design Header as another TaskList. Each TaskList contain Tasks. How will a typical javascript template look like for this problem. I could not come with one that works this scenario. This problem is as same as N level nested Menu, how would you render it using templating library.
<div>
{{#Projects}}
<div>
<b>{{ProjectName}}</b>
</div>
<ul>
{{#TaskList}}
<li>{{TaskListName}} {{CreatedBy}} The Problem Comes here - How do i Render a #TaskList
here </li>
{{/TaskList}}
</ul>
{{/Projects}}
</div>
btw if anyone has asp.net solution (Ideas for this let me hear them), N level deep nesting is the thing i am unable to overcome right now.
You could define your
TaskListas a partial and include it recursively as the documentation hints.Templates:
JavaScript:
Here’s the jsFiddle to see it in action- http://jsfiddle.net/maxbeatty/ND7xv/