PDA

View Full Version : Ext 2.0 Beta 1 - FormPanel fireEvent problem



israelws
22 Oct 2007, 8:02 AM
Hi,
Ext ver 2.0 is great !
(I'm using Ext 2.0 Beta 1).

I'm extending a FormPanel object.
I need to capture an event (a button click) in an instanse of the drived object container.
The problem is that the event is not being fiered/captured in the container.

The event I'm trying to use is:


function getSearch(){
var args='args';
this.fireEvent('searchClicked',args);
};


It is fired from a function that is assgined to a button handler:


buttons:[{
text:SEARCH_FORM_BOTTON_TEXT,
handler:getSearch
}]


The container object listen to the event using the following code:

var simpleSearchFoodForm=new FoodSimpleSearchForm();
...
...
simpleSearchFoodForm.on({
'searchClicked':function(args){
alert('event captured');
},
scope:this
});

This is the code for the driven object:



FoodSimpleSearchForm=function(){
FoodSimpleSearchForm.superclass.constructor.call(this, {
labelWidth: 75, // label settings here cascade unless overridden
frame:true,
bodyStyle:'padding:5px 5px 0',
defaultType:'textfield',
labelAlign:'top',
header:false,
headerAsText:false,
autoScroll:false,
items: [{
fieldLabel: SEARCH_FORM_CRITERIA_LABEL,
name: 'Criteria',
allowBlank:false,
width:277
},{ xtype:'fieldset',
title: 'Search Type',
autoHeight:true,
items:[{
layout:'column',
items:[
new Ext.form.Radio({
boxLabel: SEARCH_FORM_RADIO_ID_LABEL,
name: 'searchType',
checked:true
}),
new Ext.form.Radio({
boxLabel: SEARCH_FORM_RADIO_NAME_LABEL,
name: 'searchType'
})]}]
}],
buttons:[{
text:SEARCH_FORM_BOTTON_TEXT,
handler:getSearch
}] });//end constractor

this.getItemValue=function(fieldName){
return this.getForm().findField(fieldName).getValue();
};

function getSearch(){
var args='args';
this.fireEvent('searchClicked',args);
};

}


Ext.extend(FoodSimpleSearchForm, Ext.form.FormPanel, {

});



please help!

thanks.