Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trackable fires events on all collections, even if element is not in it. #188

Closed
gtk-aschmidt opened this issue Jun 22, 2016 · 2 comments
Closed
Assignees

Comments

@gtk-aschmidt
Copy link

Let's say I have one store, and two collections defined on that store, each viewing a different subset of information, and I'm tracking both collections:

// Only the Driver's comments
this.driverCollection=this.commentStore.filter({
    vehicleid:this.vehicleid,
    inspectitemid:this.inspectitemid,
    commenter:'Driver'
}).sort([{property:'commenttime',descending:true}]).track();

// Only the Mechanic's comments
this.mechanicCollection=this.commentStore.filter({
    vehicleid:this.vehicleid,
    inspectitemid:this.inspectitemid,
    commenter:'Mechanic'
}).sort([{property:'commenttime',descending:true}]).track();

If I add a listener to each collection and add a record, both listeners are notified.

this.mechanicCollection.on('delete,add,update',function(evt){
    // I will get events when the commenter is 'Driver'
});
@denov
Copy link

denov commented Nov 29, 2017

i'm also seeing this behavior 1.1.2. one would expect the track to only happen on the collection and not the store.

@edhager
Copy link
Contributor

edhager commented Feb 11, 2019

@gtk-aschmidt and @denov,

We landed a fix in the master branch. the Store#on method now supports a third, optional parameter. Take a look at the comments in #222 to see the limitations of registering an "update" event listener.

wkeese added a commit to ibm-js/delite that referenced this issue Feb 25, 2019
don't match the filter on a tracked collection.

Refs dojo/dojo1-dstore#188.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants