Question

Does anybody know if jsRender has something similar to the ASP.net EmptyDataTemplate ??? I ask because I'd like to show a message in a html table, that was created using a template , when there is no data.

Thanks in advance.

Was it helpful?

Solution

When using {{for}} to loop over an array, you can use {{else}} for the case where the array is empty.

See http://www.jsviews.com/#fortag - in particular the section where the following example is shown:

{{for members}}
  <div>{{:name}}</div>
{{else}}
  <div>No members!</div>
{{/for}}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top