You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I actually work with the "FeatureStore" class and I need to filter my features depending on many attributes but not just just one.
So I decided to override the "onLoad" function to use the native store's filter and it's looks like that :
onLoad: function(store,records,successful,eOpts){this._removing=true;store.layer.removeAllFeatures();deletethis._removing;// Array of the records I'll keep for the layer.varkeepedRecords=[];for(vari=0;i<records.length;i++){varaRecord=records[i];varfiltersOK=true;// I verify if the records match with each filters and, if not, I exclude it from the record's array.for(varf=0;f<store.filters.items.length;f++){varaFilter=store.filters.items[f];if(!aFilter.filterFn(aRecord)){filtersOK=false;break;}}if(filtersOK){console.log(aRecord);keepedRecords.push(aRecord);}}// Finally I add my keeped records to my layer.this.addFeaturesToLayer(keepedRecords);}
For example I have this filter :
{property: "myAttribute",value: myValue}
That works perfectly for me. I've just not ever try by modifying my filters yet but I'll do it soon.
Have you another solution tu use many filters in a FeatureStore ?
Thank you in advance,
Julien Collard
The text was updated successfully, but these errors were encountered:
I actually work with the "FeatureStore" class and I need to filter my features depending on many attributes but not just just one.
So I decided to override the "onLoad" function to use the native store's filter and it's looks like that :
For example I have this filter :
That works perfectly for me. I've just not ever try by modifying my filters yet but I'll do it soon.
Have you another solution tu use many filters in a FeatureStore ?
Thank you in advance,
Julien Collard
The text was updated successfully, but these errors were encountered: