PDA

View Full Version : Dynamically call a function inside Ext js class



sanjay_1985
24 Jan 2014, 2:23 AM
Hi,
1. I would want to dynamically call a method with params inside Ext js class from anchor tag.
I am trying to do this

"<a href='#' onclick=javaScript: new IN.controller.ControllerName().callFunction('"+value+"');> "+value+"</a>";

2. I am also trying to do the same thing here. Method name would be some thing like "IN.controller.ControllerName"
window[methodName](params);

The above code is not working. Could you please let me know how to solve this issue?

DineshGudikandula
24 Jan 2014, 3:47 AM
try with this


.
"<a href='#' onclick="+new IN.controller.ControllerName().callFunction("'"+value+"');> "+value+"</a>";

sanjay_1985
24 Jan 2014, 4:51 AM
Hi,
value= "<a href='#' onclick="+new IN.controller.Controller().function("'"+value+"');> "+value+"</a>";
This is what I tried. I am getting Uncaught SyntaxError: Unexpected token ; at run time.

DineshGudikandula
24 Jan 2014, 5:42 AM
"<a href='#' onclick="+new IN.controller.ControllerName().callFunction(value)+">"+value+"</a>";

palakurthivishal
25 Jan 2014, 6:28 AM
Hi sanjay_1985,
Before you call the method of controller, create an object for that controller ( if in case it is not singleton), like this

onclick = javascript:myFunction()


function myFunc(){
var obj = Ext.create('ControllerNamespace');
obj.method();
}