May 08, 2012, 7:47 AM
[CLOSED] Store update: Cannot call method 'hasCls' of null
Hi,
This was working until recently (I think it may have broken with the calendar updates). The scenario I have is a GridPanel and a DataView both using the same store. There is a button that switches visibility between DataView and GridPanel view.
The code I use to switch them is:
By default the DataView is visible and the GridPanel is hidden. The exception is thrown when I attempt to update a record in the Store and the GridPanel hasn't been set to visible. If I switch between GridPanel/DataView at least once then the code works fine, it only throws the exception if the GridPanel has never been made visible.
The code I use to change the record in the Store is:
The exception is thrown in:
This was working until recently (I think it may have broken with the calendar updates). The scenario I have is a GridPanel and a DataView both using the same store. There is a button that switches visibility between DataView and GridPanel view.
The code I use to switch them is:
setView: function (view) {
switch (view) {
case "list":
App.gridPanelList.setVisible(true);
App.dataViewIcons.setVisible(false);
break;
case "icon":
App.gridPanelList.setVisible(false);
App.dataViewIcons.setVisible(true);
break;
}
},
By default the DataView is visible and the GridPanel is hidden. The exception is thrown when I attempt to update a record in the Store and the GridPanel hasn't been set to visible. If I switch between GridPanel/DataView at least once then the code works fine, it only throws the exception if the GridPanel has never been made visible.
The code I use to change the record in the Store is:
var contentItem = App.StoreContent.getById(id);
if (contentItem != null) {
contentItem.set("InBasket", true);
contentItem.commit();
}
The exception is thrown in:
onUpdate : function(store, record, operation, changedFieldNames) {
var me = this,
index,
newRow, oldRow,
oldCells, newCells, len, i,
columns, overItemCls,
isHovered, row;
if (me.rendered) {
index = me.store.indexOf(record);
columns = me.headerCt.getGridColumns();
overItemCls = me.overItemCls;
if (columns.length && index > -1) {
newRow = me.bufferRender([record], index)[0];
oldRow = me.all.item(index);
isHovered = oldRow.hasCls(overItemCls);Uncaught TypeError: Cannot call method 'hasCls' of null
oldRow.dom.className = newRow.className;
if(isHovered) {
oldRow.addCls(overItemCls);
}
oldCells = oldRow.query(this.cellSelector);
newCells = Ext.fly(newRow).query(this.cellSelector);
len = newCells.length;
row = oldCells[0].parentNode;
for (i = 0; i < len; i++) {
if (me.shouldUpdateCell(columns[i], changedFieldNames)) {
row.insertBefore(newCells[i], oldCells[i]);
row.removeChild(oldCells[i]);
}
}
me.selModel.refresh();
me.doStripeRows(index, index);
me.fireEvent('itemupdate', record, index, newRow);
}
}
},
Last edited by Daniil; Aug 27, 2012 at 7:59 AM.
Reason: [CLOSED]