Reputation: 27
I am experiencing an issue when I reconfigure my grid which has a rowexpander plugin in it. If I remove the plugin it is working fine. I tried the below fix too but no luck
Ext.override(Ext.grid.plugin.RowExpander, {
beforeReconfigure: function (grid, store, columns, oldStore, oldColumns) {
var expander = this.getHeaderConfig();
expander.locked = true;
if (columns)
columns.unshift(expander);
}
});
This is the error thown
Unhandled exception at line 9988, column 13 in script block
0x80070057 - Microsoft JScript runtime error: Invalid argument.
It was thrown from the below location of the extjs script block
onColumnsChanged: function(headerCt) {
var items = this.view.el.query(this.rowBodyTdSelector),
colspan = headerCt.getVisibleGridColumns().length,
len = items.length,
i;
for (i = 0; i < len; ++i) {
items[i].colSpan = colspan; // **the error thown location is this**
}
},
Please help ! Thanks in advance !!
Upvotes: 2
Views: 1492
Reputation: 27
Use the below override
overrideRowBodyOnColumnChanged: function () {
for (var i = 0 ; i < this.features.length; i++) {
if (this.features[i].ftype == 'rowbody') {
Ext.override(this.features[i], {
onColumnsChanged: function (headerCt) {
var items = this.view.el.query(this.rowBodyTdSelector),
colspan = headerCt.getVisibleGridColumns().length,
len = items.length,
i;
colspan = colspan == 0 ? 1 : colspan;
for (i = 0; i < len; ++i) {
items[i].colSpan = colspan;
}
}
});
break;
}
}
},
and call this override function in the initComponent function of the grid
initComponent: function () {
// your code
this.overrideRowBodyOnColumnChanged();
}
Upvotes: 0
Reputation: 198
It might be a bit too late, but anyway..
Can you confirm it only happens in IE? Mozilla and Chrome seem to be ok with it.
Apparently IE doesn't like colspan=0
, and at some point the code tries to assign 0 to the colSpan property of the item and the error is thrown.
I've tried changing it to items[i].colSpan = colspan || 1;
and the problem was solved, but of course this is not a solution. I'm trying to check if this is a real bug or just lack of knowledge! :)
EDIT:
Although I couldn't find any solution, to make it work I just overridden the method using Ext.override
and left it that way.
EDIT2:
As proposed by ojintoad
, you can also use something like .setAttribute('colSpan', 1);
, to change the colspan value from 0 to 1.
Upvotes: 3