0

为了在服务器上实现过滤,但在客户端分页,我想做类似的事情:

var cachedStore = Cache.create(myRestStore);
var cachedCollection = cachedStore.filter(...);

// Get all the rows from the server matching my filter and cache them,
// then return the first 10.
var firstPage = cachedCollection.fetchRange({ start: 0, end: 10 });

// Get second 10 rows from the cache.
var secondPage = cachedCollection.fetchRange({ start: 10, end: 20 });

这应该工作吗?我已阅读https://github.com/SitePen/dstore/blob/master/docs/Stores.md#cache但我不清楚功能,尤其是canCacheQuery()功能。

我也想过:

var cachedCollection = Cache.create(myRestStore.filter(...));

// Get all the rows from the server matching my filter and cache them,
// then return the first 10.
var firstPage = cachedCollection.fetchRange({ start: 0, end: 10 });

// Get second 10 rows from the cache.
var secondPage = cachedCollection.fetchRange({ start: 10, end: 20 });

似乎不支持,因为Cache设计为 wrap Stores,而不是 wrap Collections

4

0 回答 0