Tuesday, June 4, 2024
 Popular · Latest · Hot · Upcoming
28
rated 0 times [  35] [ 7]  / answers: 1 / hits: 28546  / 14 Years ago, fri, june 25, 2010, 12:00:00

I have the simple form:



   myForm = new Ext.form.FormPanel({
width:'100%',
frame:false,
items: [
new Ext.form.TextArea({
id:'notes',
name: 'notes',
hideLabel: true,
width:350,
height:200
})
],
buttons: [
{
text:Save,
click: function (b,e) {
alert('x');
}
}
]
});


However I am having trouble getting the click event of the button to work. Do buttons created the following way have the same functionality of doing Ext.Button?


More From » extjs

 Answers
64

You either need



a) The handler option (a click shortcut)



new Ext.Button({
handler: function(){
// ....
}
});


b) Event listeners need to be registered in in a listeners block, so



new Ext.Button({
listeners: {
click: function(){
// ...
}
}
});


A) is preferred.


[#96407] Monday, June 21, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lincolnx

Total Points: 602
Total Questions: 90
Total Answers: 94

Location: Saint Lucia
Member since Wed, Feb 8, 2023
1 Year ago
;