bgultekin / laravel-datatables-bundle

Laravel Datatables Bundle helps to handle server-side works of Datatables Jquery Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL Error on Column Filter with Joined Table

AndreaScotti opened this issue · comments

Hello,
I get a SQL error during a column filtering in a Joined Datatables. I founded that the problem is in the function filtering() of Datatables.php around the line 428.

It is getting the name of the column with the declaration like: tablejoined.column as newcolumn LIKE .......

I fixed it in a simple way just using the same code as the normal filter using

$copy_this = $this;
preg_match('#^(\S_?)\s+as\s+(\S_?)$#si',$copy_this->columns[$i],$matches);
$column = empty($matches) ? $copy_this->columns[$i] : $matches[1];

Hope this help someone and you can fix it in the next release. So I can update it without problem.

Bye bye Andrea