Using jsonRest with filteringSelect widget

351 Views Asked by At

I start working onchanging all widgets that can be rebuild using jsonRest rather than Memory, like filteringSelect and Dgrid in my app.
After I fixed the filteringSelect, replaced the memory with jsonRest and tested that it works well, I tried to use store/cache with it. the testing showed that caching is not happening, and when I searched the web, I got with someone's answer:

http://dojo-toolkit.33424.n3.nabble.com/How-to-use-FilteringSelect-with-a-JsonRest-store-and-a-Cache-store-td3994386.html

this issue tells that cache not working with filteringSelect, but I need to use request. on the other hand, "request" requests the data immediately so it's not an option.

Can you give the right answer: 1. Does cache work with jsonRest on filteringSelect? 2. Can I use dgrid with jsonRest and cache also?

thanks

1

There are 1 best solutions below

2
On

While JsonRest can be used with Cache just fine (regardless of what widget consumes it), the important thing to consider (which that mailing list post points out) is that dojo/store/Cache does not cache query calls to the store, only get calls, since query calls can include any variety of range, filter, and sort parameters. So I don't think you'd get the effect out of using Cache that you're expecting.

If your service doesn't have a large number of records, another option would be to use dojo-smore's RequestMemory store, which is essentially a middle ground between Memory and JsonRest - it requests the full data set once (though it does request it as soon as the store is created), but then stores the entire set in memory for all query and get calls.