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.

Était-ce utile?

La 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}}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top