Pergunta

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.

Foi útil?

Solução

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}}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top