0

i'm using dropdrownlist within grid from kendo-ui (html) with typescript

problem is i have to call a function in string

export class ClassName extends BaseController {

    public configureGrid()
        {

           .... //other codes

              columnView.template =  "#= methodToBeCalled(columnValue) #";
        }
    }

    public methodToBeCalled(...params:any[])
            {
                return "something";
            }

how should i call 'methodToBeCalled' from typescript which is defined in string. i tried these combinations, and non of them worked

      columnView.template =  "#= methodToBeCalled(columnValue) #";
      columnView.template =  "#= this.methodToBeCalled(columnValue) #";
      columnView.template =  "#= _this.methodToBeCalled(columnValue) #";
      columnView.template =  "#= ClassName.methodToBeCalled(columnValue) #";
Amirreza
  • 575
  • 9
  • 25

1 Answers1

1

Try compiling the template manually and then using Function.prototype.bind:

columnView.template = kendo.template("#=methodToBeCalled(columnValue)#").bind(this);
Atanas Korchev
  • 30,562
  • 8
  • 59
  • 93