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

or filters not working with multiple args #189

Closed
urgetech opened this issue Jul 14, 2016 · 1 comment
Closed

or filters not working with multiple args #189

urgetech opened this issue Jul 14, 2016 · 1 comment

Comments

@urgetech
Copy link

The issue is when combining an or with an and in the 2nd clause.

     require([ 'dojo/when',  'dstore/Memory' ],
        function(when, Memory)
        {

          var store = new Memory({data: [], idProperty: 'id'});
          store.setData([{id:1, name:'a'}, {id: 2, name: 'b'}]);

          var f = store.Filter;

          var myFilter = f.prototype.or(new f({id: 1}), new f({id: 2}));
          console.log("Works: simple or")
          when(store.filter(myFilter).fetch(), function(allItems)
          {
              console.log('filtered size: '+ allItems.length);
          });          

          var myFilter = f.prototype.or(new f({id: 1}), new f({id: 2, name: 'b'}));
          console.log("Fails: or with and on 2nd arg")
          when(store.filter(myFilter).fetch(), function(allItems)
          {
              console.log('filtered size: '+ allItems.length);
          });

          var myFilter = f.prototype.or(new f({id: 1, name: 'a'}), new f({id: 2}));
          console.log("Works: reverse the order of the args")
          when(store.filter(myFilter).fetch(), function(allItems)
          {
              console.log('filtered size: '+ allItems.length);
          });
     });
@edhager
Copy link
Member

edhager commented Aug 18, 2016

A fix was landed in master and will be included in the next release.

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

2 participants