Reputation: 1734
Hello i am have grid "Book" (id, name, price) and other grid "Sale" (id, name, price). I am insert records from "Book" to "Sale" with DragandDrop. But I need if user drop record to grid "Sale" and grid "Sale" already have same record (with same ID) - not drop this record. What do I need?
Upvotes: 0
Views: 342
Reputation: 2203
use beforeadd listener and find out the old duplicate record and delete it!!
listeners:{
beforeadd:function(store, records, index, eOpts) {
for (var i in records) {
var idx = store.findExact('id', records[i].get('id'));
if ( /*compare idx with new record id */) {
store.remove(records[i]);
}
}
}
}
Upvotes: 1