类A中的Kendo TreeList代码(类型记录文件):我从kendo模板调用了一个函数。
export class A{
drillDownDataSource: any;
constructor() {
this.GetStatutoryIncomeGridViewData();
}
GetStatutoryIncomeGridViewData() {
$.ajax({
type: 'POST',
url: 'Controller/Action/',
data: stfilterData,
success: function (data) {
$("#grid").kendoTreeList({
dataSource: data,
columns: [
{ field: "Transaction1",
template:kendo.template("#=FormatNumberToEn(Transaction1)#").bind(this) },
}
});
});
public FormatNumberToEn(value) { }
}
}
误差function FormatNumberToEn is undefined
发布于 2016-09-08 08:47:06
如果您想在KendoUI模板中使用函数,就必须在全局(JavaScript-)范围内定义它们。(参考文献)
只需从类FormatNumberToEn
中提取A
函数即可。
export class A {
/* class definition */
}
function FormatNumberToEn(value) { /* function logic */ }
或者,将您的函数定义为static
并在模板中调用A.FormatNumberToEn()
也可能有效。(现在不能测试它,因为我在手机上。)
https://stackoverflow.com/questions/39384524
复制相似问题