Skip to main content

Posts

Showing posts with the label jquery-templates

JQuery Templates - too much recursion

I am using jquery templates to generate a tree structure to later display as a treeview of sections and items. The structure of data looks like this, where each section has items and sections and each item can have more sections: section items item sections item sections sections section sections items ...and so on My templates then recursively call each other: <script id="my-item-tmpl" type="text/x-jquery-tmpl"> <li> <span>${text}</span> <ul> {{each sections}} {{tmpl($value) "sectionTmpl"}} {{/each}} </ul> </li> </script> <script id="my-section-tmpl" type="text/x-jquery-tmpl"> <li> <span>${text}</span> <ul> {{each items}} {{tmpl($value) "itemTmpl"}} {{/eac