Question

I have seen examples of using dojo/request wrapper around dojo.xhrGet: http://dojotoolkit.org/documentation/tutorials/1.9/populating_datagrid/ and JsonRest object store: http://dojotoolkit.org/reference-guide/1.9/dojo/store/JsonRest.html#dojo-store-jsonrest to populate datagrid.

Can anyone tell me what are the pros and cons of using one over the other? I would like to use Gridx tree grid example and wondered which one would be best and why.

Thanks!

Was it helpful?

Solution

Well, the dojo/store/JsonRest store will also allow you to create/update/delete items in your store which will be updated on your service as well. The only thing to know is that you have to follow certain guidelines when creating your service, which is explained at the reference guide.

With dojo/request/xhr (AMD version of dojo.xhr), you can request information (such as the data from a REST service), but you will have to manually add it to a store which you could use in your grid.

So if your plan is to create/update/delete data as well, then dojo/store/JsonRest is probably the best choice. If it isn't, then you can still pick the dojo/store/JsonRest store if the webservice is conform or dojo/request/xhr when it isn't.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top