PDA

View Full Version : When to use Ext.Ajax versus a Data Store



mwarner
23 Feb 2015, 9:35 PM
I am building a navigation tree whose nodes will come from different underlying database tables. I am currently getting an array of text for the initial set of nodes. so the response looks like:
["Node 1", "Node 2", "Node 3", etc]. So there are no fields for the model of the data store. I am using the load event to get the records and then dynamically add them to the tree.

Would it be more appropriate to just use Ext.Ajax.request instead of a store?

Thanks

Michelle

joel.watson
28 Feb 2015, 3:48 PM
I am building a navigation tree whose nodes will come from different underlying database tables. I am currently getting an array of text for the initial set of nodes. so the response looks like:
["Node 1", "Node 2", "Node 3", etc]. So there are no fields for the model of the data store. I am using the load event to get the records and then dynamically add them to the tree.

Would it be more appropriate to just use Ext.Ajax.request instead of a store?

Hi--

I don't know about "more appropriate". Most of the time, these kind of questions come down to what makes the most sense for the context in which they are needed. If you find it easier to use Ext.Ajax.request to retrieve the data you need, that's a perfectly appropriate way to go about it. If you are going to be loading different levels of the tree "lazily", then using the store's methods from start to finish might be an easier approach. But again, it ultimately comes down to what you need to do and what is the most efficient way within your app.

Thanks!
Joel