user2585299
user2585299

Reputation: 883

Apply breeze predicate to data in an observable array

I am executing breeze queries for my entities and storing the data in browser local cache. If I happen to load these entities in future, instead of executing the breeze query again I am loading the data from local storage into observable arrays. I was wondering how can I filter data in these observable arrays by applying breeze predicates since I won't be executing breeze queries again.

Is it possible to apply breeze predicates on an observable array to filter data ?

Upvotes: 0

Views: 152

Answers (1)

Jeremy Danyow
Jeremy Danyow

Reputation: 26396

Breeze has the ability to execute your query locally. For this to work you'll need to load the data from local storage into a breeze entity manager. There are several ways to do this (importEntities, attachEntity), the approach depends on how you are storing and retrieving your entities from local storage. It would make your life easier if you used exportEntities and importEntities when storing/retrieving entity data from local storage. If you do choose to use exportEntites, pay careful attention to the includeMetadata argument. You may want to cache the metadata separately to save space.

Upvotes: 1

Related Questions