Kendo TreeView如何基于Jquery中的授权选择模板

时间:2019-02-13 22:24:56

标签: kendo-treeview

Kendo TreeView如何基于Jquery中的授权来选择模板

我有一个Kendo TreeView,它具有AuthorizationFlag(Y或N)来决定是使用Template1还是Template2。我该如何实现。 例如,如果我收到的响应为Y,则应该加载template1或Template2

<script id="template1" type="text/kendo-ui-template">
If Auth is Success
</script>

<script id="template2" type="text/kendo-ui-template">
If Auth is fail
</script>

1 个答案:

答案 0 :(得分:0)

我想让Harsha pps顺服!

<script type="text/x-kendo-template" id="myTemplate">
    #if(task.Auth== 'Y'){#
        <div>If Auth is Success</div>
    #}else{#
        <div>If Auth is fail</div>
    #}#
</script>

我假设授权Y / N在变量Auth

请检查Teleriks example