dstore icon indicating copy to clipboard operation
dstore copied to clipboard

Cache dont work with Rest when it use fetch with range

Open akaJes opened this issue 9 years ago • 1 comments

when you explicite set to Collection creation canCacheQuery:true, than slowly scroll grid to end and back You can see network activity in devTools instead using a cache maybe cache for ranging fetch must configurate another way?

used for tests https://github.com/SitePen/dgrid/blob/master/test/Rest.html with canCacheQuery:true, inserted https://github.com/SitePen/dgrid/blob/master/test/Rest.html#L44 I explored the code and realized that the variable allLoaded is not set ever for fetch with range

akaJes avatar Feb 06 '15 11:02 akaJes

I am trying to Cache the results of a Rest store so a dijit Filtering Select doens't continue to hit the server every time a user drops down the combo box. Even after setting canCacheQuery: true and isValidFetchCache: true the Rest store continues to hit the server. isAvailableInCache() returns undefined no matter how I set things up.

Any ideas on how to get this to work?

// GenericItemStore
define([
      "dojo/_base/declare",
      "dstore/Rest",
      "dstore/Cache",
      "dstore/Memory"
   ],
   function(declare, Rest, Cache, Memory){
      return declare([Rest, Cache], {
         isValidFetchCache:   true,
         canCacheQuery:       true
     });
});

// Filtering Select Gadget
define([
      "dojo/_base/declare",
      "dijit/form/FilteringSelect",
      "dstore/legacy/DstoreAdapter",
      "ts/store/GenericItemStore"
   ],
   function(declare, FilteringSelect, DstoreAdapter, GenericItemStore){
      return declare([FilteringSelect], {
         style:            "width:100%",
         allowAllOption:   false,
         searchAttr:       'Name',
         labelAttr:        '_label',
         labelType:        'html',
         constructor: function(args)
         {
            // Call Super
            dojo.safeMixin(this, args);

            var store = new GenericItemStore({
               target: '/Stores/Employees'
            });

            this.store = new DstoreAdapter(store.filter({includeAll: 'true', includeBlankOption: 'true'}));
         }
     });
});

EToreo avatar Jun 07 '15 00:06 EToreo