PDA

View Full Version : Removing multiple records


thejoker101
05-22-2007, 10:56 AM
Would it be possible to change the remove function in Store to also take an array of Records or a single Record? Using multiple select, the user may want to delete several records and I see it kind of pointless to remove one record at a time when all could be removed at the same time and especially if you run a script to remove them in the database it seems pointless to run the script for each removed item.

Possible change:
bulkRemove : function(records) {
for (i = 0; i < records.length; i++) {
this.remove(records[i]);
}
this.fireEvent("bulkremove",this,records);
},


This just involved adding a bulkremove function and event. Since the GridView seems to depend upon remove firing on a single row, it didn't seem feasible to modify that function.

thejoker101
07-02-2007, 10:32 AM
Any feedback on this? I still haven't seen this added and I know I'm not the only one who doesn't want to do a connection request each time the remove event is called.

jack.slocum
07-02-2007, 04:56 PM
It seems you have your function so I would go that route. It would a lot of work to add it to the ext core (all classes that use a store would have to be modified to respond to bulkremove as well).

thejoker101
07-03-2007, 01:33 PM
It seems you have your function so I would go that route. It would a lot of work to add it to the ext core (all classes that use a store would have to be modified to respond to bulkremove as well).

Actually it wouldn't unless you wanted them to use the bulkremove event since the bulkremove function calls remove on each record which fires the regular remove event. All the changes required is adding an event and a function. It doesn't impact any existing code. It's just more of a nicety for when you don't want to have to listen for remove 20 times to remove 20 records on the server side.