View Full Version : help with data

8 Jul 2010, 3:06 PM
I'm new to Ext and Senchatouch, and had some questions on best practices with data.

Right now, I'm using the Ext.Ajax.request to populate a NestedListed from a json string. Everytime I reload the card, it hits the server and queries for data which is not needed. In fact, I only need to populate the list once.

In jqTouch, I checked that the data wasn't already loaded before making an ajax request.

I was wondering what would be the best way to store this data client side, without actually using localstorage. Is there any way I could make an ajax request once, store it some type of object to be reused for that session? I'd also like the ability to sort this data/list as well.

What would be the best way to accomplish this?

9 Jul 2010, 4:34 AM
I'm doing something similar with stores and NestedList (any code you want to share appreciated too!).

Couple questions. What do you mean 'reload the card'? You mean show it? You could, say, load your json store when the page is ready once and just not reload the store on other events. Or one pattern I use is a single json store load on page load and take results from it to populate multiple ArrayStores so they don't separately make calls. then I control when the server requests can occur.

just some ideas.

9 Jul 2010, 6:53 AM
By "reload the card", I just meant to redisplay it.

When you say json store, do you mean one of the classes in Ext.data. I'm new to Ext. If anybody is familiar with asp.net, I would like an object like .NET's DataSet. This is an object that stores rows in memory. You can sort, group, etc the rows in this object.


9 Jul 2010, 7:16 AM
Yes, it works that way. So study the touch and Extjs API docs and examples and it should be fairly easy from there.

9 Jul 2010, 7:42 AM
Thanks. I got it working with the data store. Now I have an issue with sorting. It only sorts the first time. The next time I display the card, and call the same sort method the list still displays the old sort order.

13 Jul 2010, 11:39 AM
Would it be possible to provide some source code that shows this behavior profunctional? This could be a bug, in which case we want to fix it asap.

13 Jul 2010, 12:01 PM
Hi Tommy,

I resolved this by recreating my NestedList on each sort. I was trying to rebuild the same NestedList var, which does not work.

14 Jul 2010, 11:55 AM
Ok, nice workaround. NestedList is going to be backed by a store in a future version, which should make this easier.

6 Aug 2010, 12:48 AM
Is the Future there?
i mean, can i use a Store and a NestedList?