PDA

View Full Version : Fire clear event when Store is empty?



aconran
22 Feb 2007, 9:08 AM
Just a suggestion and maybe this doesn't make sense in all cases. But I think it would be useful to fire the clear event on a data store if you remove all the records.

Ie I have 3 records in my store and call remove on all 3.

I think this may clean up code like the following:

ds.on('remove', function() {
if (!ds.getCount())
tbDeleteFindingBtn.disable();
});

Seems to me that the clear event should signify that all records have been removed and not be so tightly bound to the removeAll function.

jack.slocum
22 Feb 2007, 4:39 PM
The clear event is specifically for when you clear the data store (to avoid numerous delete events). Firing the event delete + clear, would kind of defeat the purpose -> causing 2 grid, view (or other component) renders.