PDA

View Full Version : uncaught exception: Element.alignToXY with an element that doesn't exist



teko
3 Aug 2011, 3:10 PM
Hello All,

I'm trying to dynamically add and remove fields to a formPanel. The first time I add fields everything works fine. but when I remove and try to add another fields, I get the error: "uncaught exception: Element.alignToXY with an element that doesn't exist"
I'm using Ext JS Library 3.3.1. Below is the code:

//The dynamic form class



Ext.ux.DynamicForm = Ext.extend(Ext.FormPanel, {

reloadFormFields : function() {
this.fieldsStore.load({
scope : this,
callback : function(records, o, s) {
if (s) {
for (var i = 0; i < records.length; i++) {
this.add(records[i].data);
};
this.doLayout();
}
}
});
}
});


//the store that return the list of form fields
var fstore = Ext.StoreMgr.get('fieldsStore');

// new DynamicForm
var frmTmp = new Ext.ux.DynamicForm({fieldsStore: fstore})

//load fields

frmTmp.reloadFormFields();


//remove all fields

if(frmTmp.items != undefined){
frmTmp.items.each(function(item){
frmTmp.remove(item, true);
});
}
frmTmp.doLayout();




can anybody give me help about this issue please?

Thanks in advance for your time.