PDA

View Full Version : Ext.data.Store - moving Records



doc
25 Sep 2007, 3:35 PM
Is there an equivalent in the data store to move a record from one position to another?
In the moment I'm using the following small helper extension:


/**
* Ext.data.Store extension to move a record within the data store
* @param {Number} from Move record from
* @param {Number} to Move record to
*/
Ext.data.Store.prototype.move = function(from, to){
var r = this.getAt(from);
this.data.removeAt(from);
this.data.insert(to, r);
this.fireEvent("move", this, from, to);
};

mystix
25 Sep 2007, 7:19 PM
Is there an equivalent in the data store to move a record from one position to another?
In the moment I'm using the following small helper extension:


/**
* Ext.data.Store extension to move a record within the data store
* @param {Number} from Move record from
* @param {Number} to Move record to
*/
Ext.data.Store.prototype.move = function(from, to){
var r = this.getAt(from);
this.data.removeAt(from);
this.data.insert(to, r);
this.fireEvent("move", this, from, to);
};


neat.
i'll move this to the Ext.ux forum.