see this thread
http://extjs.com/forum/showthread.php?t=12193&highlight=indexOf
if you select one or some row(s), reload datastore then remove selected row(s) ,an error occured!
ds.reload();
rec=model.getSelected();
if(rec) ds.remove(rec);
If you can't access SVN, add this to your script. It is the fixed function from SVN. It must be executed AFTER ext-all.js has loaded.
Ext.override(Ext.grid.RowSelectionModel, {
onRefresh : function(){
var ds = this.grid.dataSource, index;
var s = this.getSelections();
this.clearSelections(true);
for(var i = 0, len = s.length; i < len; i++){
var r = s[i];
if((index = ds.indexOfId(r.id)) != -1){
this.selectRow(index, true);
}
}
}
});
The selection model tracks the GridView rather than the store. If a record which the same id is loaded, I definitely see where the problem could occur. Please check the version in SVN and let me know if it resolves the issue for you.
I think there is a bug in the Grid.
If the Store is reloaded, it fires "datachanged". The GridView handles that event, and updates the UI, but the Grid's SelectionModel is unaffected by this and its Array of selected Records is unchanged and obsolete.
The SelectionModel also needs to know when the data has changed.
It could either remove all selections, or reselect the same row numbers that were previously selected depending on a config option.
yes!,use this code before bug fixed!
var id=rec.get("id");
rec=ds.getById(id);
index=ds.indexOf(rec);
model.deselectRow(index);
model.selectRow(index);
rec=model.getSelected();
ds.remove(rec);
I think there is a bug in the Grid.
If the Store is reloaded, it fires "datachanged". The GridView handles that event, and updates the UI, but the Grid's SelectionModel is unaffected by this and its Array of selected Records is unchanged and obsolete.
The SelectionModel also needs to know when the data has changed.
It could either remove all selections, or reselect the same row numbers that were previously selected depending on a config option.
yes,this patch is useable!
Allergies.. no relief?!?
Religion in the workplace? |