PDA

View Full Version : Unused call and optimisation in GridView.js



perrich
4 Jun 2007, 10:45 AM
(...)
refreshRow : function(record){
var ds = this.ds, index;
if(typeof record == 'number'){
index = record;
record = ds.getAt(index);
}else{
index = ds.indexOf(record);
}
var rows = this.getRowComposite(index); // <- unused var can be deleted
var cls = [];
this.insertRows(ds, index, index, true); // <- I think that insert rows can be optimised by send record (it can remove ds.getRange() in renderRows)
this.onRemove(ds, record, index+1, true);
this.syncRowHeights(index, index);
this.layout();
this.fireEvent("rowupdated", this, index, record);
}


I've tried to add dynamic update (by messaging services) of a grid. But Store seems to be requested even if record is already in memory (and can be sent by method parameters ?).

If you add record to insertRows and also renderRows, you can use record without call Store and some check can be removed ?
It can be also a bad idea...