PDA

View Full Version : Error in selecting combobox item: me.dom.className is undefined



rpoddar
30 Jun 2012, 11:26 PM
Hi,

I am using ExtJs 4.0.7. I am facing issue in selecting combobox item.

When i try to select an item from combobox list it gives following error:
me.dom.className is undefined (at ext-all-debug.js line 8449)

It gives error at following line:
space = ((me.dom.className.replace(trimRe, '') == '') ? "" : " "),

I have used following code for combobox:


{

xtype: 'combo',
name: 'xyz',
store: cache.getStore('CommonStore'),
displayField: 'label',
valueField: 'value',
hiddenName:'value',
queryMode:'local',
typeAhead: true,
editable: false,
forceSelection: true,
hideLabel: true,
hideTrigger:false,
autoSelect: true

},


Used following code to create store:


var store = Ext.create('CommonStore', {storeId: 'CommonStore'});
store.load({
scope : this,
callback: function(records, operation, success) {
cache.addStore('CommonStore', store );
}
});


Please hep me to fix this issue.


Thanks,
Hiren

skirtle
1 Jul 2012, 4:31 AM
Could you provide the full stacktrace please?

Using the debugger, can you check what me and me.dom are?

scottmartin
1 Jul 2012, 3:06 PM
Remove hiddenName property and see if you still get this error. This is not supported in 4.07, but has made a return in 4.1.1

Scott.

rpoddar
1 Jul 2012, 10:21 PM
Hi Scott,

Removed hiddenName property from combo but still giving the same error.

Thanks,
Rabi

rpoddar
1 Jul 2012, 10:29 PM
@skirtle,

Attached me.png, medom.png and stack.png which shows value of me, me.dom and stacktrace.

Thanks,
Rabi

skirtle
2 Jul 2012, 3:20 AM
The plot thickens.

Does this problem only happen in Firefox or is it all browsers? If it's just Firefox, could you let us know the version and OS?

rpoddar
2 Jul 2012, 4:56 AM
It happens in IE, Firefox and Chrome.

Thanks,
Rabi

skirtle
2 Jul 2012, 5:32 AM
Strange. From your screenshot it seems that the DOM node in question has at least one CSS class on it so quite how className can be missing I'm not sure.

Could you check whether the id for this input element is the same as the id of the input element of your combobox? I'm wondering whether it's trying to update the wrong element for some reason, perhaps one that is no longer in the DOM.

rpoddar
4 Jul 2012, 2:52 AM
Hi skirtle,

Yesterday it was my mistake and i attached wrong images.
Attached updated images of me.dom and stacktrace.

me.dom is referring to Model object. Is it correct?

Thanks,
Rabi

rpoddar
5 Jul 2012, 1:29 AM
Here we have multiple frames(Frame1 and Frame2). We are creating Store in one frame(Frame1) and trying to access that store in combobox avaiable in another frame(Frame2).


For above scenario, in following function passed nodeInfo object is instanceOf "Ext.data.Model" but then also nodeInfo instanceOf Ext.data.Model returns false. Due to that following function returns Record object to addClass for which dom.className is undefined.






Ext.view.AbstractView.js
-----------------------------
getNode : function(nodeInfo) {
if (!this.rendered) {
return null;
}
if (Ext.isString(nodeInfo)) {
return document.getElementById(nodeInfo);
}
if (Ext.isNumber(nodeInfo)) {
return this.all.elements[nodeInfo];
}
if (nodeInfo instanceof Ext.data.Model) {
return this.getNodeByRecord(nodeInfo);
}
return nodeInfo;
},








Does instanceOf operator does not work across the frames?


Is there any other solution availabel to access the Store(created in one frame) to combobox in other frame?

skirtle
5 Jul 2012, 2:02 AM
Each frame has a separate global object so the Ext.data.Model in one frame will not be the same as the Ext.data.Model in the other frame. The instanceof operator has no chance.

In 4.1 that instanceof check has been changed to:


getNode : function(nodeInfo) {
...
if (nodeInfo.isModel) {
return this.getNodeByRecord(nodeInfo);
}
return nodeInfo; // already an HTMLElement
},

Trying to work with multiple frames can cause all sorts of problems and there's not really official support for it. You need to be careful to keep the interaction between the frames down to a minimum. Generally I wouldn't advise passing non-anonymous objects or functions between frames. Try to keep communication between the frames very simple, invoking functions in the target is about as much as I'd trust.