KendoGrid 模板函数中的传值
Pass value in KendoGrid template function
我正在尝试传递行的值
进入模板函数
{
field: "RuleName",
template: ruleRadioActive(<MyValueHere>),
title: global.textJSPartialView["RuleName"],
headerTemplate: *bla bla*
}
我想将 "RuleName" 值传递给函数 ruleRadioActive。
我试过使用 "#= RuleName #"
但它会传递字符串而不是值。
有什么解决办法吗?
所以基本上我发现在模板选项中使用一个函数
会自动将具有整个行结构的对象发送给该函数。
所以如果我有:
{
field: "RuleName",
template: templateFunction,
title: global.textJSPartialView["RuleName"],
headerTemplate: *bla bla*
}
我想打印一个 <p>
其中有一些值
函数 templateFunction
看起来像这样:
function templateFunction(DataItem){
return "<p>" + DataItem.<element in structure> + "</p>";
}
我正在尝试传递行的值
进入模板函数
{
field: "RuleName",
template: ruleRadioActive(<MyValueHere>),
title: global.textJSPartialView["RuleName"],
headerTemplate: *bla bla*
}
我想将 "RuleName" 值传递给函数 ruleRadioActive。
我试过使用 "#= RuleName #"
但它会传递字符串而不是值。
有什么解决办法吗?
所以基本上我发现在模板选项中使用一个函数
会自动将具有整个行结构的对象发送给该函数。
所以如果我有:
{
field: "RuleName",
template: templateFunction,
title: global.textJSPartialView["RuleName"],
headerTemplate: *bla bla*
}
我想打印一个 <p>
其中有一些值
函数 templateFunction
看起来像这样:
function templateFunction(DataItem){
return "<p>" + DataItem.<element in structure> + "</p>";
}