PDA

View Full Version : [INFOREQ][3.1] Form's afterrender event does not consider child elements on Safari



hubefonseca
25 Jan 2010, 1:45 PM
It seems that the Ext afterrender event is fired but not all form elements are yet rendered.

On the afterrender listener, I try to access the .rendered property on the form component and on one of its children. Although the form.rendered property is true, its child property is false.

It seems the problem only occurs in Safari. I resolved it with a delay on the afterrender listener function.

Please let me know if someone is facing the same problem, and if it's really a bug.

There is an example (some pieces are omitted for simplicity):


this.items = [
{
itemId : 'displayModeSet',
xtype: 'fieldset',
title : 'Modo exibição',
items: {
layout:'column',

items:[
{
items : [
{
itemId : 'timeline',
xtype : 'radio',
boxLabel: 'Temporal',
name: 'behaviour',
inputValue: 'timeline',
root : 'config'
},
{
itemId : 'showlast',
checked : true,
xtype : 'radio',
labelSeparator: '',
boxLabel: 'Última informação',
name: 'behaviour',
inputValue: 'showlast',
root : 'config'
}
]
},
{
items : [
{
itemId : 'numEventsToDisplay',
fieldLabel : 'Número de eventos exibidos',
xtype : 'numberfield',
name : 'numEventsToDisplay',
root : 'config',
value : 100
}
]
}
]
}
}
];



this.form = new Ext.form.FormPanel({
items : this.items,
layout : 'form',
listeners: {
afterrender: {
fn: this.setDefaultFieldsVisible,
scope: this
}
}
});


And finally the listener definition:


setDefaultFieldsVisible: function() {
console.debug(this.form.rendered); // this is true
console.debug(this.form.getComponent('displayModeSet').items.get(0).items.get(1).rendered); // this is false
}

Jamie Avins
25 Jan 2010, 2:24 PM
What version of Ext are you using?

hubefonseca
25 Jan 2010, 2:27 PM
I'm using Ext 3.1