KendoUI根据某些列值启用/禁用自定义命令 [英] KendoUI Enable/disable custom command based on some column value
本文介绍了KendoUI根据某些列值启用/禁用自定义命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想基于其他一些列在kendo-ui网格中启用/禁用自定义命令。我如何实现这一目标?下面是示例代码
I wants to enable/disable custom command in kendo-ui grid based on some other column. How do i achieve that? Below is sample code
@(Html.Kendo().Grid<Model>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(a => a.Name).Width(90);
columns.Bound(a => a.Flag).Width(170);
columns.Command(commands => commands.Custom("ABC").Text("ABC").Click("ABC")).Title ("ABC").Width(130);
...
}
我想根据标志值启用/禁用ABC命令按钮。请帮帮我
I want to enable/disable ABC command button based on flag value. Please help me
推荐答案
我解决了问题。下面是示例代码。
I solved the problem. Below is the sample code.
columns.Bound(a => a.Flag).ClientTemplate(
"# if(Flag == 'Value1') { #" + "<input type="button">
class='info k-button k-button- icontext' onclick='clickhere(#=parameter1#)'
value='ClickHere' />" +
"# } else { #" +
"NormalText" +
"# } #").Width(100).Title("ConditionalButton");
//JavaScript
<script type="text/javascript">
function clickhere(parameter1) {
window.location.href = '@Url.Action("Event", "Home")' +
'?parameter1=' + parameter1;
}
</script>
</input>
这篇关于KendoUI根据某些列值启用/禁用自定义命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文