Calling function from control designer

Posted by Community Admin on 05-Aug-2018 14:42

Calling function from control designer

All Replies

Posted by Community Admin on 10-Feb-2011 00:00

Hi,

I have a control designer which has all the usual applyChanges, refreshUI etc. How can I write a function that I can calls another function, not via an event handler. e.g.

refreshUI: function()
myfunction();
,
myfunction: function()
alert('hi world');


Thanks
higgsy

Posted by Community Admin on 15-Feb-2011 00:00

Hi higgsy,

You are on the proper path to achieving this. When you call the function from other function you should use this.myfunction(). Consider sample bellow:

refreshUI: function ()
    this.myFunction();
,
 
myFunction: function ()
    alert("hello world");


Kind regards,
Radoslav Georgiev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Posted by Community Admin on 17-Feb-2011 00:00

Hi Radoslav,

Thanks for your response, one other thing though - how do you pass parameters to that function, i.e.:

refreshUI: function ()
    this.myFunction('Hello world');
,
  
myFunction: function (inputString)
    alert(inputString);

Thanks
higgsy

Posted by Community Admin on 17-Feb-2011 00:00

Hi higgsy,

There should not be a problem if you have this scenario

refreshUI: function ()
    this.myfunction("test");
 
,
 
myfunction: function (param)
    alert(param);
,

I attached short video

Kind regards,
Ivan Dimitrov
the Telerik team

This thread is closed