문제

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.

도움이 되었습니까?

해결책

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}}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top