gpt4 book ai didi

javascript - 如何在剑道 GridView 中添加条件

转载 作者:行者123 更新时间:2023-11-29 22:03:58 25 4
gpt4 key购买 nike

我需要显示/隐藏 remove(delete( icon)based on condition.for ex var a=2,var b=2;if(a=b) 需要显示图标。但是 a!= b 表示隐藏删除图标。如何做到这一点?

{
command: {
template: kendo.template($("#remove").html())
}, title: " ", width: "40px"
}

<script id="remove" type="text/x-kendo-tmpl">
<a href="" onclick="remove(this); return false;">
<img src="@Url.Content("~/Images/delete_icon.gif")" alt="Remove item" />
</a>
</script>

最佳答案

您可以在模板中使用 javascript:

<script id="remove" type="text/x-kendo-tmpl">
# var a=2; var b=2;#
# if(a==b){ #
<a href="" onclick="remove(this); return false;">
<img src="@Url.Content("~/Images/delete_icon.gif")" alt="Remove item" />
</a>
# } #
</script>

检查 Kendo UI Templates Overview有关更详细的示例和剑道的不同模板语法:

  1. 渲染文字值:#= #
  2. 呈现 HTML 编码值:#:#
  3. 执行任意 JavaScript 代码:# if(...){# ... #}#

关于javascript - 如何在剑道 GridView 中添加条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22005637/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com