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:
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.
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();
});

|
#2
|
|
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.
![]() |
本文讨论了数据存储清除事件的应用场景及其实现方式。提出当所有记录被移除时触发清除事件的观点,并探讨了该事件与删除事件之间的区别,旨在简化代码逻辑并提高效率。
6967

被折叠的 条评论
为什么被折叠?



