Fire clear event when Store is empty? - Ext JS

本文讨论了数据存储清除事件的应用场景及其实现方式。提出当所有记录被移除时触发清除事件的观点,并探讨了该事件与删除事件之间的区别,旨在简化代码逻辑并提高效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.
Reply With Quote
  #2  
Old 02-22-2007, 06:39 PM
Default

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.
Reply With Quote
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值