Sencha – models and stores only showing one item

Sencha – models and stores only showing one item

I’ve started to look at Sencha Ext JS and Touch and well so much to go on about but if I start on about it I’ll probably never actually get around to finishing this post so I’m going to try and keep them (my posts) short, to the point and frequent (hah I always say that to myself!) as I learn and find out more stuff about it.

So first tip – Do you only see one item in your list? If so the following may help.

Having created a model (which in Flex terms is a VO essentially – Value Object). I then created a Store. This is where you can load any data or hard code it for testing things before you create a web service or similar.

You then create a view with say a list in it. Then tell the list what Store to use by referring to its id. This will link up the store (with the data) and the store is linked to the model. You run the app and you will only see one item in the list. Which would be fine if the data only had one item, but it doesn’t.
(You’ll know what I’m meaning without going into more details if you have this problem, if not just comment)

In order to make the list show more than just the last item of data you must give your model an idProperty other than the default of ‘id’.

Very annoying and their may well be a good reason for it, I just haven’t found it yet. If you’re reading this, feel free to tell me why. As I learn Touch, I’ll hopefully be adding my experiences here.

[ad name=”ad-1″]

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.