dojodgriddstore

Dgrid collection data not accessible after filtering on collection


So, I am using collection in my dgrid and the store is of type [Memory, Trackable]. I am using store filtering (as given here). When I filter the store data, then the returned collection object does not have any data attribute and thus I am unable to access the data from the collection. Although, the changes are reflected in the d-grid when I change the collection but I need to access the data from collection to do other things.

Here is my code:

var filterObj= new this.store.Filter();
var tagFilter= filterObj.in('tagList', selectedTags);
var newCollection= this.store.filter(tagFilter);
this.grid.set('collection', newCollection);

I am unable to retrieve data from newCollection as well as from this.grid.collection. Am I doing something wrong here?


Solution

  • The fetch (and fetchSync in the case of Memory) APIs are the correct public APIs to use (and that is why dgrid still has no trouble querying the collection).

    data is an implementation detail, and you shouldn't really be trying to access a store/collection's data via the data property. That is ordinarily present on the root store when it gets mixed in via constructor arguments.