开发者

Sencha store group by id

开发者 https://www.devze.com 2023-02-23 02:25 出处:网络
In Sencha, I have a store with some products in. Each products has his own id, name, price... I can add an item to a store, but when I add the same item multiple times to a store, I want the store to

In Sencha, I have a store with some products in. Each products has his own id, name, price... I can add an item to a store, but when I add the same item multiple times to a store, I want the store to have only one item of the same id.

E.g. when I click an 'add' button in a product-detail-view multiple times, I want the product to only be once in the store. In MySQL it would be like 'GROUP BY id'.

开发者_JAVA百科

I hope someone can help me with this!

Thanks in advance!


You probably need to add a listener for the Add event of the store. In the event code, check to see if the added item/items (these will be passed to the event in a parameter, see Sencha Touch API Documentation for details) are already in the store. If yes, remove the new items from the store.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号