Moving Records between Stores
January 5th, 2009I'm using DnD between Views (I'll post an Ext.ux.DDView soon), and the dragData is an Array of Records. This is going to be a super-useful DnD pattern - dragging between Views.
Anyway, shouldn't
join : function(store){
this.store = store;
}
be
join : function(store){
if (this.store) {
this.store.remove(this);
}
this.store = store;
}
?
/**
* Creates a copy of this record.
* @param {String} newId (optional) A new record id if you don't want to use this record's id
* @return {Record}
*/
copy : function(newId) {
return new this.constructor(Ext.apply({}, this.data), newId this.id);
}
I am not sure about "auto remove" as it may cause a repaint somewhere that the end developer wants to control (like me ;)). I do agree though it seems like a natural thing to do.
DDView sounds like a great idea. Any chance you want to make it compatible with DataView in 2.0? There are a few nice existing plugins for DataView (DragSelector, LabelEditor) and a DD one would be the best plugin yet.
FYI, your clone function above could be:
clone : function() {
return new this.constructor(Ext.apply({}, this.data), this.id);
}
I am adding it to the codebase, by I think I will call it copy. Sound ok?
I'll tackle refactoring to 2.0 soon. Maybe autumn.
clone : function() {
var newData = {};
for (var p in this.data) {
newData[p] = this.data[p];
}
return new this.constructor(newData, this.id);
}
To aid in copy DnD operations.
DnD using Ext.Records is the way to go!
#If you have any other info about this subject , Please add it free.# |