PDA

View Full Version : Problem with adding new fields to FormPanel in IE



HugoEsteves
25 Nov 2011, 2:59 AM
Hi,

I´m having a problem in IE, i have a application that has a mainscreen where i have a grid and a form panel and all fileds in the form panel are created dinamically in this screen everything works fine the fields are all created, the problem is that when i doubleclick any row in the grid it should open another screen and in that when i try to add a combo it gives me a error in ext but only in IE

the code where it gives the error is below on bold, the line in ext-all-debug is 43936.



constructor: function(config) {
config = config || {};


var me = this,
groupers = config.groupers || me.groupers,
groupField = config.groupField || me.groupField,
proxy,
data;

if (config.buffered || me.buffered) {
me.prefetchData = Ext.create('Ext.util.MixedCollection', false, function(record) {
return record.index;
});
me.pendingRequests = [];
me.pagesRequested = [];

me.sortOnLoad = false;
me.filterOnLoad = false;
}

me.addEvents(

'beforeprefetch',

'groupchange',

'prefetch'
);
data = config.data || me.data;



me.data = Ext.create('Ext.util.MixedCollection', false, function(record) {
return record.internalId;
});


if (data) {
me.inlineData = data;
delete config.data;
}

if (!groupers && groupField) {
groupers = [{
property : groupField,
direction: config.groupDir || me.groupDir
}];
}
delete config.groupers;

me.groupers = Ext.create('Ext.util.MixedCollection');
me.groupers.addAll(me.decodeGroupers(groupers));


this.callParent([config]);


if (me.groupers.items.length) {
me.sort(me.groupers.items, 'prepend', false);
}


proxy = me.proxy;
data = me.inlineData;


if (data) {
if (proxy instanceof Ext.data.proxy.Memory) {
proxy.data = data;
me.read();
} else {
me.add.apply(me, data);
}


me.sort();
delete me.inlineData;
} else if (me.autoLoad) {
Ext.defer(me.load, 10, me, [typeof me.autoLoad === 'object' ? me.autoLoad: undefined]);


}
}



the combo i'm trying to create is something like this:



fieldContainer = {
idFn: item.idFn,
name: item.name,
columnWidth: pColumnWidth,
labelSeparator: pLabelSep,
margin: '5 10 5 5',
xtype: item.xtype,
editable: false,
displayField: 'desc',
valueField: 'id',
store: item.values,
fieldOperator: pFieldOper,
labelWidth: 100,
allowBlank: !item.allowBlank,
readOnly: item.disabled,
queryMode: 'local',
fieldLabel: item.label,
triggerAction: 'all',
typeAhead: false
};


the item.values is an array of objects, and the erro message is: "the object doens't support this property or method", the error occurs when i try to add this combo to the container, does anyone had this problem or something similar?

mitchellsimoens
25 Nov 2011, 6:38 AM
If you read the store config on the ComboBox you should see what you did wrong: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox-cfg-store

You can't give it an Array of Objects... Can be a 1 or 2 dimensional Array.

HugoEsteves
25 Nov 2011, 9:53 AM
If you read the store config on the ComboBox you should see what you did wrong: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox-cfg-store

You can't give it an Array of Objects... Can be a 1 or 2 dimensional Array.
Hi,

i was not passing an array of objects but a 2 dimensional array, but like i said i have 2 screens the mainscreen and the processScreen, in the mainScreen i receive an object with all the fields that i have to create so i have a var to store the fields that i will need in the processScreen, when i double click a grid in mainScreen the processScreen is opened and i use the window.opener to get the object with the fields that i need to create.




fieldContainer = {
idFn: item.idFn,
name: item.name,
columnWidth: pColumnWidth,
labelSeparator: pLabelSep,
margin: '5 10 5 5',
xtype: item.xtype,
editable: false,
displayField: 'desc',
valueField: 'id',
store: item.values,
fieldOperator: pFieldOper,
labelWidth: 100,
allowBlank: !item.allowBlank,
readOnly: item.disabled,
queryMode: 'local',
fieldLabel: item.label,
triggerAction: 'all',
typeAhead: false
};


I don´t know why but in IE in the mainScreen the item.values that i use to create the store is a 2 dimensional array but in the processScreen after i get the object with window.opener if i use the development tools from IE it says its a array of objects and i don´t know why is this hapening as it only occurs in IE.

What i did to resolve this problem was when i store the object with the fields properties i do a Ext.encode and then in processScreen i do a Ext.decode, this way the object is ok.

If you any ideia why this happen let me know, and thanks for your help.

mitchellsimoens
25 Nov 2011, 10:05 AM
Sorry, was thrown off by this:


the item.values is an array of objects, and the erro message is: "the object doens't support this property or method", the error occurs when i try to add this combo to the container, does anyone had this problem or something similar?