Apr 04, 2012, 5:59 PM
[CLOSED] ext:Button: Adding listener to a click event
Hi!
I'm creating my ext:window as javascript: It is working.
But, I wish pass the buttons of window as parameter of the function;
I'm creating a function below to create a button. But my problem is: I want set the javascript that be executed when the button is clicked.
In vb.Net, i do this:
I'm creating my ext:window as javascript: It is working.
But, I wish pass the buttons of window as parameter of the function;
I'm creating a function below to create a button. But my problem is: I want set the javascript that be executed when the button is clicked.
In vb.Net, i do this:
function createButton(text as string, fn as string)
dim btn = New Ext.Net.Button
btn.Id = "btnOk"
btn.Text = text
btn.Listeners.Click.Handler = fn
return btn
end function
How I do it in Javascript?
function createButton(text, fn) {
var btn;
btn = Ext.create("Ext.button.Button", {
id: "btn" + text,
text: text
});
btn.on("click", "function () {" + fn + "}");
return btn;
}
Last edited by geoffrey.mcgill; Apr 13, 2012 at 12:09 AM.
Reason: [CLOSED]