{"action":"created","issue":{"url":"https://api.github.com/repos/ghiscoding/aurelia-slickgrid/issues/63","repository_url":"https://api.github.com/repos/ghiscoding/aurelia-slickgrid","labels_url":"https://api.github.com/repos/ghiscoding/aurelia-slickgrid/issues/63/labels{/name}","comments_url":"https://api.github.com/repos/ghiscoding/aurelia-slickgrid/issues/63/comments","events_url":"https://api.github.com/repos/ghiscoding/aurelia-slickgrid/issues/63/events","html_url":"https://github.com/ghiscoding/aurelia-slickgrid/issues/63","id":324396996,"number":63,"title":"[Question] collectionFilterBy documentation","user":{"login":"jmzagorski","id":8404957,"avatar_url":"https://avatars2.githubusercontent.com/u/8404957?v=4","gravatar_id":"","url":"https://api.github.com/users/jmzagorski","html_url":"https://github.com/jmzagorski","followers_url":"https://api.github.com/users/jmzagorski/followers","following_url":"https://api.github.com/users/jmzagorski/following{/other_user}","gists_url":"https://api.github.com/users/jmzagorski/gists{/gist_id}","starred_url":"https://api.github.com/users/jmzagorski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmzagorski/subscriptions","organizations_url":"https://api.github.com/users/jmzagorski/orgs","repos_url":"https://api.github.com/users/jmzagorski/repos","events_url":"https://api.github.com/users/jmzagorski/events{/privacy}","received_events_url":"https://api.github.com/users/jmzagorski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-05-18T12:46:46Z","updated_at":"2018-05-18T14:38:51Z","closed_at":null,"author_association":"COLLABORATOR","body":"**I'm submitting a feature request**\r\n\r\n* **Framework Version:**\r\nCurrent\r\n\r\n* **Browser:**\r\nall\r\n\r\n* **Language:**\r\nTypeScript X.X\r\n\r\n**Current behavior:**\r\nthe collectionFilterBy filters your collection for values not equal to the collectionFilterBy.value when operator is \"EQ\"\r\n\r\n**Expected/desired behavior:**\r\nClarification, maybe documentation. I initially thought that if I passed 'Task2' in the collectionFilterBy.value (like in example 3), that the filter by service will filter for 'Task 2', but it seems the service \"filters out\" task 2 and shows everything else when the operator is \"equal\". Not sure if anyone else was confused by this, but I stumbled on it. First, i want to make sure this is not a bug and 2 if this is the design, I can add documentation that filter means filter out or exclude this value to potentially help others like me :-)\r\n"},"comment":{"url":"https://api.github.com/repos/ghiscoding/aurelia-slickgrid/issues/comments/390228266","html_url":"https://github.com/ghiscoding/aurelia-slickgrid/issues/63#issuecomment-390228266","issue_url":"https://api.github.com/repos/ghiscoding/aurelia-slickgrid/issues/63","id":390228266,"user":{"login":"jmzagorski","id":8404957,"avatar_url":"https://avatars2.githubusercontent.com/u/8404957?v=4","gravatar_id":"","url":"https://api.github.com/users/jmzagorski","html_url":"https://github.com/jmzagorski","followers_url":"https://api.github.com/users/jmzagorski/followers","following_url":"https://api.github.com/users/jmzagorski/following{/other_user}","gists_url":"https://api.github.com/users/jmzagorski/gists{/gist_id}","starred_url":"https://api.github.com/users/jmzagorski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmzagorski/subscriptions","organizations_url":"https://api.github.com/users/jmzagorski/orgs","repos_url":"https://api.github.com/users/jmzagorski/repos","events_url":"https://api.github.com/users/jmzagorski/events{/privacy}","received_events_url":"https://api.github.com/users/jmzagorski/received_events","type":"User","site_admin":false},"created_at":"2018-05-18T14:38:51Z","updated_at":"2018-05-18T14:38:51Z","author_association":"COLLABORATOR","body":"No reason, it does not matter to me as long as there is documentation to describe to API. I am fine either way.\r\n\r\nAlso, I will be submitting a PR to add `in`, `notIn` and `contains` to the filterBy logic if i understand the meaning of the OperatorTypes. If you want me to reverse the `EQ` and `NEQ` logic, just let me know.\r\n\r\n```diff\r\n-      if (operator === OperatorType.equal) {\r\n-        filteredCollection = collection.filter((item) => item[property] !== value);\r\n-      } else {\r\n-        filteredCollection = collection.filter((item) => item[property] === value);\r\n-      }\r\n+      switch (operator) {\r\n+       case OperatorType.equal:\r\n+          filteredCollection = collection.filter((item) => item[property] !== value);\r\n+          break;\r\n+       case OperatorType.in:\r\n+          filteredCollection = collection.filter((item) => item[property].indexOf(value) !== -1);\r\n+          break;\r\n+       case OperatorType.notIn:\r\n+         filteredCollection = collection.filter((item) => item[property].indexOf(value) === -1);\r\n+          break;\r\n+        case OperatorType.contains:\r\n+          filteredCollection = collection.filter((item) => value.indexOf(item[property]) !== -1);\r\n+          break;\r\n+        default:\r\n+          filteredCollection = collection.filter((item) => item[property] === value);\r\n+      }\r\n\r\n```\r\n\r\n\r\n"}}
{"actor":{"display_login":"jmzagorski"}}