You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I downloaded the latest version of jsRender and I have some issues regarding the layout template.
I used to use
{{for ListData tmpl="#LayoutTmpl" ~variable=value Layout=true /}}
but after a quick view in latest version of jsRender code I saw that in the the "Layout" variable renamed to "isLayout".
but with no luck. The nested layout template is rendered as a normal template and since the data object isn't recognized as a type of list, I am getting the "do something" so many times as the length of the list.
The same code works with a previous version (// informal pre beta commit counter: 6)
How can I fix this for the latest version?
Thanks in advance
The text was updated successfully, but these errors were encountered:
Rather than setting layout=true, or isLayout=true, you simply need to pass your data array wrapped as an array, {{for [myArray]...}} so JsRender will treat the myArray as a single object. This is a similar to how you bind to arrays in jQuery: $([myArray]).bind(...).
This change follows feedback (see issue 118 for example) around the layout template feature.
Please reopen if this new approach does not enable your scenario... thanks.
I downloaded the latest version of jsRender and I have some issues regarding the layout template.
I used to use
{{for ListData tmpl="#LayoutTmpl" ~variable=value Layout=true /}}
but after a quick view in latest version of jsRender code I saw that in the the "Layout" variable renamed to "isLayout".
I tried this
{{for ListData tmpl="#LayoutTmpl" ~variable=value isLayout=true /}}
< script id="LayoutTmpl" type="tex t/x-jsrender" >
{{:#parent.parent.data.propertyName}}
{{if #data.length > 0}}
{{for #data}}
{{:propertyName}}
{{/for}}
{{else}}
do something
{{/if}}
</ script>
but with no luck. The nested layout template is rendered as a normal template and since the data object isn't recognized as a type of list, I am getting the "do something" so many times as the length of the list.
The same code works with a previous version (// informal pre beta commit counter: 6)
How can I fix this for the latest version?
Thanks in advance
The text was updated successfully, but these errors were encountered: