PDA

View Full Version : EXTJS 4.1.0 "dom is null or not an object" (STILL)



iamjonsmith
25 Nov 2013, 7:32 AM
I am running EXTJS 4.1.0

I have a site that once the main window loads, a tree grid is loaded into that page with lots of rows and columns. The cells are set up to hold a TIME. You can enter a time, submit, and it saves that time for the employee. If you tab out of one of these cells and hit the submit button, IE8 & IE9 throw the following error:

"'dom' is null or not an object"

I ran the debugger and it appears to occur in the Ext.grid.CellEditor. When I hit f12 and run the tools, it points to the error being in ext-all.js. I pulled the following code from ext-all-debug.js as this is where the debug ended up leading me

The error occurs in this defined area:

Ext.define('Ext.grid.CellEditor', {
extend: 'Ext.Editor',
constructor: function(config) {
config = Ext.apply({}, config);

if (config.field) {
config.field.monitorTab = false;
}
this.callParent([config]);
},


onShow: function() {
var me = this,
innerCell = me.boundEl.first(),
lastChild,
textNode;


if (innerCell) {
lastChild = innerCell.dom.lastChild;
if(lastChild && lastChild.nodeType === 3) {

textNode = me.cellTextNode = innerCell.dom.lastChild;

me.cellTextValue = textNode.nodeValue;


textNode.nodeValue = '\u00a0';
}
}
me.callParent(arguments);
},



onHide: function() {
var me = this,
innerCell = me.boundEl.first();


if (innerCell && me.cellTextNode) {
me.cellTextNode.nodeValue = me.cellTextValue;
delete me.cellTextNode;
delete me.cellTextValue;
}
me.callParent(arguments);
},



afterRender: function() {
var me = this,
field = me.field;


me.callParent(arguments);
if (field.isXType('checkboxfield')) {
field.mon(field.inputEl, {
mousedown: me.onCheckBoxMouseDown,
click: me.onCheckBoxClick,
scope: me
});
}
},


onCheckBoxMouseDown: function() {
this.completeEdit = Ext.emptyFn;
},


onCheckBoxClick: function() {
delete this.completeEdit;
this.field.focus(false, 10);
},


realign: function(autoSize) {
var me = this,
boundEl = me.boundEl,
innerCell = boundEl.first(),
children = innerCell.dom.childNodes,
childCount = children.length,
offsets = Ext.Array.clone(me.offsets),
inputEl = me.field.inputEl,
lastChild, leftBound, rightBound, width;







if(me.isForTree && (childCount > 1 || (childCount === 1 && children[0].nodeType !== 3))) {

lastChild = innerCell.last();

leftBound = lastChild.getOffsetsTo(innerCell)[0] + lastChild.getWidth();



rightBound = innerCell.getWidth();


width = rightBound - leftBound;


if(!me.editingPlugin.grid.columnLines) {
width --;
}

offsets[0] += leftBound;


me.addCls(Ext.baseCSSPrefix + 'grid-editor-on-text-node');
} else {
width = boundEl.getWidth() - 1;
}


if (autoSize === true) {
me.field.setWidth(width);
}


me.alignTo(boundEl, me.alignment, offsets);
},

onEditorTab: function(e){
var field = this.field;
if (field.onEditorTab) {
field.onEditorTab(e);
}
},


alignment: "tl-tl",
hideEl : false,
cls: Ext.baseCSSPrefix + "small-editor " + Ext.baseCSSPrefix + "grid-editor",
shim: false,
shadow: false
});

Specifically here:

realign: function(autoSize) {
var me = this,
boundEl = me.boundEl,
innerCell = boundEl.first(),
children = innerCell.dom.childNodes, **ERROR HERE**
childCount = children.length,
offsets = Ext.Array.clone(me.offsets),
inputEl = me.field.inputEl,
lastChild, leftBound, rightBound, width;



I am sure there is something trying to happen after the form is destroyed by the submit button, but I have no idea how to fix. Please help.

Gary Schlosberg
25 Nov 2013, 8:54 AM
Difficult to say without a test case. Does the issue still occur using 4.2.1?

iamjonsmith
25 Nov 2013, 8:59 AM
Client Runs EXTJS 4.1.0, no idea if the issue occurs in 4.2x

jbanasiak
26 Nov 2013, 12:44 AM
Steps to reproduce
1) Create a blank architect project for extjs 4.2.x
2) Added some panels to a viewport
3) Run in browser IE8 (works in chrome/firefox just fine)

Webpage error details


User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB7.5; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Timestamp: Tue, 26 Nov 2013 08:38:00 UTC




Message: 'head' is null or not an object
Line: 1906
Char: 9
Code: 0
URI: /bootstrap.js





function addMeta(name, content) {
var meta = document.createElement('meta');
meta.setAttribute('name', name);
meta.setAttribute('content', content)
head.appendChild(meta);
}

iamjonsmith
26 Nov 2013, 6:24 AM
Thanks jbanasiak,
being new to EXTJS I was unsure how to create a test case for v4.2x. Now that you have created a test case to reproduce in 4.2, is this a Sencha Problem, or a problem with my code? Does anyone have any ideas about a fix?

jacoviza
17 Dec 2013, 6:52 AM
I have the exact same error, did you find any way of sorting it out?