开发者

Sencha store group by id

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜