PDA

View Full Version : GridView 'findHeaderIndex' IE7 bug



fabrizim
19 Apr 2007, 5:22 AM
I added a toolbar to the header panel of a gridview, and after a button is clicked, I was receiving Ext.fly(...) is not an object errors within IE. I tracked it down and found where the problem was.

The GridView class should be changed from (GridView.js Line 401 in 1.0 release):


findHeaderIndex : function(n){
var r = Ext.fly(n).findParent("td." + this.hdClass, 6);
return r ? this.getCellIndex(r) : false;
},

findHeaderCell : function(n){
var r = Ext.fly(n).findParent("td." + this.hdClass, 6);
return r ? r : false;
},


to:


findHeaderIndex : function(n){
if(!n){
return false;
}
var r = Ext.fly(n).findParent("td." + this.hdClass, 6);
return r ? this.getCellIndex(r) : false;
},

findHeaderCell : function(n){
if(!n){
return false;
}
var r = Ext.fly(n).findParent("td." + this.hdClass, 6);
return r ? r : false;
},


It looks like this check is already in place for findRowIndex, and possibly others. I think the problem is from an event returning a bad target in IE.

Regards-
Mark

amackay11
13 Jun 2007, 5:58 AM
Bump... this still seems to be a problem in 1.1 B1, using ext-base.js

http://extjs.com/forum/showthread.php?p=38777

evant
31 Oct 2007, 2:36 PM
Hey guys,

Bumping this one up, I'm having a similar issue and the proposed code above seems to work. Can you have a(nother?) look into this?

navdimri
22 Jul 2009, 5:27 AM
Hi All,

I am also getting the same javascript error with IE: Ext.fly(...) is null or not an object.
I am using below files in my application:

EditableItem.js
RangeMenu.js
GridFilters.js
Filters.js
StringFilter.js
DateFilter.js
ListFilter.js
NumericFilter.js
columnLock.js
BooleanFilter.js

Also, I have tried both fixes inside my javascript file, but it didn't work.
1.



Ext.override(Ext.EventObjectImpl, {
getTarget : function(selector, maxDepth, returnEl){
var targetElement;
try {
targetElement = selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : this.target;
} catch(e) {
targetElement = this.target;
}
return targetElement;
}
});


and 2.



Ext.override(Ext.grid.GridView, {
findHeaderIndex : function(n){
if(!n){
return false;
}
var r = Ext.fly(n).findParent("td." + this.hdClass, 6);
return r ? this.getCellIndex(r) : false;
},
findHeaderCell : function(n){
if(!n){
return false;
}
var r = Ext.fly(n).findParent("td." + this.hdClass, 6);
return r ? r : false;
}
}
);


Someone, please suggest me other solution.

Thanks,
navdimri