PDA

View Full Version : How to add a default listener to a FieldSet?



teedev
2 Aug 2011, 5:00 AM
I have a FieldSet which looks like this:


var myFieldSet = new Ext.form.FieldSet;
myFieldSet.title = 'Title goes here';
myFieldSet.defaults = {
labelWidth : '35%',
listeners : {
el : {
click : function(ctl) {alert('hello')}
},
delegate : "input"
}
};It works. But I want to add a click listener later per code. It should look like this:


var myFieldSet = new Ext.form.FieldSet;
myFieldSet.title = 'Title goes here';
myFieldSet.defaults = {
labelWidth : '35%'
};

....more code....

myFieldSet.defaults.addListener('click', function() {
alert('hello');
});
This dosn't work. The event isn't fired. Please help me. Thanks!

teedev
5 Aug 2011, 7:20 AM
Any ideas? Thx!