{"action":"created","issue":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/43","labels_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/43/comments","events_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/43/events","html_url":"https://github.com/yajra/laravel-datatables/issues/43","id":75866354,"number":43,"title":"[Enhancement] DB::raw with filtering/search","user":{"login":"sameerpanjwani","id":8542695,"avatar_url":"https://avatars.githubusercontent.com/u/8542695?v=3","gravatar_id":"","url":"https://api.github.com/users/sameerpanjwani","html_url":"https://github.com/sameerpanjwani","followers_url":"https://api.github.com/users/sameerpanjwani/followers","following_url":"https://api.github.com/users/sameerpanjwani/following{/other_user}","gists_url":"https://api.github.com/users/sameerpanjwani/gists{/gist_id}","starred_url":"https://api.github.com/users/sameerpanjwani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sameerpanjwani/subscriptions","organizations_url":"https://api.github.com/users/sameerpanjwani/orgs","repos_url":"https://api.github.com/users/sameerpanjwani/repos","events_url":"https://api.github.com/users/sameerpanjwani/events{/privacy}","received_events_url":"https://api.github.com/users/sameerpanjwani/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yajra/laravel-datatables/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-05-13T06:29:34Z","updated_at":"2015-05-17T14:18:04Z","closed_at":null,"body":"I. Whenever I use `DB::raw('CONCAT(field_name_1,field_name_2) AS something')` in the \"select\", then the search/column filter does't seem to work. I see in the code you're doing something called a wrapColumn which I think is causing it to be escaped and therefore treated as a table column instead of a raw query. \r\n\r\nCan you give some option where we can specify:\r\n\r\n`->setColumnSearchType('4','raw') OR setColumnSearchType([4,8],'raw')` //and this will allow you to skip the wrapColumn clause for these columns\r\n\r\nIt might also be useful to have an additional option:\r\n\r\n`->setColumnSearchType('4','raw','having')` //because sometimes when using aggregate functions like \"MAX(score) as final_score\", if you put them in the \"where\" condition, they won't work but if you put \"HAVING final_score LIKE '%32%'\" then it works\r\n\r\nII. If pass \"column_name as alias\", doesn't seem to work but if i put \"column_name AS alias\", it works, you not allowing lowercase of \"as\"?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/comments/102807064","html_url":"https://github.com/yajra/laravel-datatables/issues/43#issuecomment-102807064","issue_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/43","id":102807064,"user":{"login":"sameerpanjwani","id":8542695,"avatar_url":"https://avatars.githubusercontent.com/u/8542695?v=3","gravatar_id":"","url":"https://api.github.com/users/sameerpanjwani","html_url":"https://github.com/sameerpanjwani","followers_url":"https://api.github.com/users/sameerpanjwani/followers","following_url":"https://api.github.com/users/sameerpanjwani/following{/other_user}","gists_url":"https://api.github.com/users/sameerpanjwani/gists{/gist_id}","starred_url":"https://api.github.com/users/sameerpanjwani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sameerpanjwani/subscriptions","organizations_url":"https://api.github.com/users/sameerpanjwani/orgs","repos_url":"https://api.github.com/users/sameerpanjwani/repos","events_url":"https://api.github.com/users/sameerpanjwani/events{/privacy}","received_events_url":"https://api.github.com/users/sameerpanjwani/received_events","type":"User","site_admin":false},"created_at":"2015-05-17T14:18:04Z","updated_at":"2015-05-17T14:18:04Z","body":"Sorry about typo. But still fails, basically the aggregate queries return a\ncolumn doesnt exist error.\nOn 17 May 2015 19:31, \"Arjay Angeles\" <notifications@github.com> wrote:\n\n> @sameerpanjwani <https://github.com/sameerpanjwani> filterColumn should\n> be called within the Datatables class and not on Query itself.\n>\n> public function getMultiFilterSelectData(){    $users = User::select([  \\DB::raw(\"CONCAT(users.id,'-',users.id) as user_id\"), 'name', 'email', 'created_at', 'updated_at']);    $datatables = Datatables::of($users);    // Global search function    if ($keyword = \\Request::get('search')['value']) {        // override users.name global search      // override users.id global search - demo for concat      $datatables->filterColumn('user_id', 'whereRaw', \"CONCAT(users.id,'-',users.id) like ?\", [\"%$keyword%\"]);    }    return $datatables->make(true);}\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/yajra/laravel-datatables/issues/43#issuecomment-102806412>\n> .\n>\n"}}