如何调用从ClientTemplate在剑道电网JavaScript方法? [英] How to call javascript method from ClientTemplate in Kendo grid?
本文介绍了如何调用从ClientTemplate在剑道电网JavaScript方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能把在剑道网格中的JavaScript语句的ClientTemplate?
我想,计算在客户端上的一些数据,然后把结果的行中
Is it possible to put in the ClientTemplate of Kendo grid a javascript statement? I would like to calculate some data on the client and then to put the result in the row.
我试过这样:
columns.Bound("ExecutionStartDateTime").Title("SummaryLine").Width("20%").ClientTemplate("<script> scheduleForm.generateSummary(#= ExecutionStartDateTime #, 2); </script>");
然而,它给了没有效果。
However, it gave no effect.
推荐答案
可以,用的模板语法:
<script>
function someFuntion(date) {
var result = "";
// Do whatever you need here (make ajax call etc..) and return result as html string
return result;
}
</script>
和约束的列:
columns.Bound("ExecutionStartDateTime").Title("SummaryLine").Width("20%")
.ClientTemplate("#=someFuntion(ExecutionStartDateTime)#");
// you can even pass 'data' implicit template parameter and extract ExecutionStartDateTime from there
您甚至可以编写JavaScript的简单的使用#如果(...){#...#}#语法内联。 <一href=\"http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/faq#how-do-i-use-a-javascript-function-in-a-column-client-template?\">This常见问题会帮助你。
You can even write inline javascript simply using # if(...){# ... #}# syntax. This faq will help you.
这篇关于如何调用从ClientTemplate在剑道电网JavaScript方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文