typescript kendo-ui 从字符串调用方法
typescript kendo-ui call method from string
我在 kendo-ui (html) 的网格中使用 dropdrownlist with typescript
问题是我必须调用字符串中的函数
export class ClassName extends BaseController {
public configureGrid()
{
.... //other codes
columnView.template = "#= methodToBeCalled(columnValue) #";
}
}
public methodToBeCalled(...params:any[])
{
return "something";
}
我应该如何从字符串中定义的打字稿中调用 'methodToBeCalled'
我尝试了这些组合,但没有一个有效
columnView.template = "#= methodToBeCalled(columnValue) #";
columnView.template = "#= this.methodToBeCalled(columnValue) #";
columnView.template = "#= _this.methodToBeCalled(columnValue) #";
columnView.template = "#= ClassName.methodToBeCalled(columnValue) #";
尝试手动编译模板,然后使用 Function.prototype.bind
:
columnView.template = kendo.template("#=methodToBeCalled(columnValue)#").bind(this);
我在 kendo-ui (html) 的网格中使用 dropdrownlist with typescript
问题是我必须调用字符串中的函数
export class ClassName extends BaseController {
public configureGrid()
{
.... //other codes
columnView.template = "#= methodToBeCalled(columnValue) #";
}
}
public methodToBeCalled(...params:any[])
{
return "something";
}
我应该如何从字符串中定义的打字稿中调用 'methodToBeCalled' 我尝试了这些组合,但没有一个有效
columnView.template = "#= methodToBeCalled(columnValue) #";
columnView.template = "#= this.methodToBeCalled(columnValue) #";
columnView.template = "#= _this.methodToBeCalled(columnValue) #";
columnView.template = "#= ClassName.methodToBeCalled(columnValue) #";
尝试手动编译模板,然后使用 Function.prototype.bind
:
columnView.template = kendo.template("#=methodToBeCalled(columnValue)#").bind(this);