PDA

View Full Version : Problem accessing child component from listener.



lagos.tout
8 Mar 2008, 12:54 PM
Hi,

Any help would be much appreciated. In the code below I keep getting a null value for emailEditor and a javascript error 'emailEditor has no properties' when the beforeCollapse event fires. What I'm trying to do is hide the HTMLEditor component with id emailEditor when the use collapses the formPanel that the HTMLEditor is in. I'm doing this because, in FireFox, I always get this weird double bounce and flicker that happens when the formPanel collapses. If there's some other way to deal with this please let me know.

Thanks much.
LT





var emailForm = new Ext.FormPanel({
formId: 'emailUser',
labelAlign: 'top',
title: 'Email',
bodyStyle:'padding: 0 10px 0 10px;',
collapsible: true,
width: '613px',
frame: true,
border: true,
listeners: {
'beforecollapse': {
fn: function (obj, event) {
alert('xxxx');
var emailEditor = obj.getComponent('emailEditor');
console.log(emailEditor);
emailEditor.hide();
}
}
},
items: [{
xtype:'textfield',
fieldLabel: 'From',
name: 'from',
vtype: 'email',
anchor:'50%',
msgTarget: 'side',
allowBlank: false
},{
xtype:'textfield',
fieldLabel: 'To',
name: 'to',
validator: emailListValidation,
anchor:'97%',
height: '50px',
msgTarget: 'side',
allowBlank: false
},{
xtype:'textfield',
fieldLabel: 'Subject',
name: 'subject',
vtype:'text',
anchor:'100%'
},{
xtype:'htmleditor',
fieldLabel: 'Subject',
name: 'emailEditor',
anchor:'100%'
}],
buttons: [{
text: 'Send'
},{
text: 'Cancel'
}]
});

lagos.tout
8 Mar 2008, 3:17 PM
Followup:

I figured out how to show and hide the HTMLEditor in the formPanel, but that did not fix the flicker. Finally, I set animCollapse to false on the formPanel and that solved it. Too bad that it's not possible to animate and without flickering.

LT