{"action":"created","issue":{"url":"https://api.github.com/repos/aldeed/meteor-tabular/issues/162","labels_url":"https://api.github.com/repos/aldeed/meteor-tabular/issues/162/labels{/name}","comments_url":"https://api.github.com/repos/aldeed/meteor-tabular/issues/162/comments","events_url":"https://api.github.com/repos/aldeed/meteor-tabular/issues/162/events","html_url":"https://github.com/aldeed/meteor-tabular/issues/162","id":87823449,"number":162,"title":"Support searching and sorting on rendered field values containing joined data","user":{"login":"Deshtructioner","id":10382356,"avatar_url":"https://avatars.githubusercontent.com/u/10382356?v=3","gravatar_id":"","url":"https://api.github.com/users/Deshtructioner","html_url":"https://github.com/Deshtructioner","followers_url":"https://api.github.com/users/Deshtructioner/followers","following_url":"https://api.github.com/users/Deshtructioner/following{/other_user}","gists_url":"https://api.github.com/users/Deshtructioner/gists{/gist_id}","starred_url":"https://api.github.com/users/Deshtructioner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deshtructioner/subscriptions","organizations_url":"https://api.github.com/users/Deshtructioner/orgs","repos_url":"https://api.github.com/users/Deshtructioner/repos","events_url":"https://api.github.com/users/Deshtructioner/events{/privacy}","received_events_url":"https://api.github.com/users/Deshtructioner/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aldeed/meteor-tabular/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/aldeed/meteor-tabular/labels/will%20accept%20pull%20request","name":"will accept pull request","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2015-06-12T19:11:41Z","updated_at":"2016-01-26T14:19:29Z","closed_at":null,"body":"When I try to search for some particular content in datatable, the search doesn't really work.\r\nTo give you an example:\r\n\r\n```js\r\nX = new orion.collection('x', {\r\n...\r\ntabular: {\r\n  columns: [\r\n    { data: \"id\", title: \"ID\" },\r\n    { data: \"creditor\", title: \"Creditor\", render: function (val, type, doc) {\r\n            var x = Creditors.findOne(val);\r\n            if(!x)\r\n                 return val + \" not found\";\r\n            return x.name;\r\n      }\r\n    },\r\n  ]\r\n}\r\n```\r\n\r\n```\r\nTABLE:\r\nID -> 1010\r\nC --> Tom Jones\r\n\r\nSEARCH RESULTS:\r\n\"10\" -> nothing\r\n\"1010\" -> returns actual row\r\n\"Tom\" --> nothing\r\n\"Tom Jones\" --> nothing\r\n```\r\n\r\nSo where ever I have render property, search returns nothing but also where I don't have render, search only returns result if input text is complete value, not a substring of table column content. I am subscribed to Creditors so that's not the problem."},"comment":{"url":"https://api.github.com/repos/aldeed/meteor-tabular/issues/comments/175037224","html_url":"https://github.com/aldeed/meteor-tabular/issues/162#issuecomment-175037224","issue_url":"https://api.github.com/repos/aldeed/meteor-tabular/issues/162","id":175037224,"user":{"login":"macrozone","id":1972353,"avatar_url":"https://avatars.githubusercontent.com/u/1972353?v=3","gravatar_id":"","url":"https://api.github.com/users/macrozone","html_url":"https://github.com/macrozone","followers_url":"https://api.github.com/users/macrozone/followers","following_url":"https://api.github.com/users/macrozone/following{/other_user}","gists_url":"https://api.github.com/users/macrozone/gists{/gist_id}","starred_url":"https://api.github.com/users/macrozone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macrozone/subscriptions","organizations_url":"https://api.github.com/users/macrozone/orgs","repos_url":"https://api.github.com/users/macrozone/repos","events_url":"https://api.github.com/users/macrozone/events{/privacy}","received_events_url":"https://api.github.com/users/macrozone/received_events","type":"User","site_admin":false},"created_at":"2016-01-26T14:19:29Z","updated_at":"2016-01-26T14:19:29Z","body":"I general, you can't automatically search and sort by computed fields. If you would want to, you would have to define the \"reverse-function\" of the render (or the helper in case of collection-helpers) that returns a mongo-selector for a given input string (in case of search).\r\n\r\nI think it is best to persist computed fields in the collection if you want to search or sort by it. You can use collection2's autoValue or collection-hooks for that.\r\n\r\n\r\n"}}