bgultekin / laravel4-datatables-package

Server-side handler of DataTables Jquery Plugin for Laravel 4
267 stars 108 forks source link

Search not working #173

Open rajeev-tx opened 10 years ago

rajeev-tx commented 10 years ago

Laravel 4.1 bllim/datatables 1.4.1 PHP version is : 5.3.10

This is exception i am getting,

{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Cannot access protected property Bllim\Datatables\Datatables::$input","file":"\vendor\bllim\datatables\src\Bllim\Datatables\Datatables.php","line":565}}

This is js code, var table = jQuery('#announcements').dataTable({ "processing": true, "serverSide": true, "columnDefs":[ {"orderable":false,"targets":7} ], "ajax": "{{ route('list/announcements','active') }}" });

This is php code,

$announcements = Announcements::select(array('id','title'))->whereRaw("'".date('Y-m-d')."' between active_at and expires_at");
return Datatables::of($announcements)->make();

ArberD commented 9 years ago

Did you manage to solve this? I'm encountering the same issue. Any help is greatly appreciated.

MarkVaughn commented 9 years ago

From reading your issue the error says the issue originates here https://github.com/bllim/laravel4-datatables-package/blob/v1.4.1/src/Bllim/Datatables/Datatables.php#L565

However I don't see any reference to $input, so are you sure the version you listed is correct?

MarkVaughn commented 9 years ago

Ok my bad, the issue is in 1.4.4 https://github.com/bllim/laravel4-datatables-package/blob/v1.4.4/src/Bllim/Datatables/Datatables.php#L565 however this code doesn't seem to be in the master branch, can you try the master branch?

mehrdd commented 9 years ago

I have a similar problem only in search (Laravel 5) My Error:

QueryException in Connection.php line 614:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key) LIKE ? or LOWER(value) LIKE ? or LOWER(type) LIKE ?)) AS count_row_table' at line 1 (SQL: select count(*) as aggregate from (select '1' as row from `settings` where (LOWER(key) LIKE %b% or LOWER(value) LIKE %b% or LOWER(type) LIKE %b%)) AS count_row_table)
MarkVaughn commented 9 years ago

it looks like the LIKE %b% should be quoted LIKE '%b%'`

Mark Vaughn Mobile: +1 (770) 533-2274

On Sun, Feb 22, 2015 at 11:35 AM, Mehrdad Nassiri notifications@github.com wrote:

I have a similar problem only in search (Laravel 5) My Error:

QueryException in Connection.php line 614: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key) LIKE ? or LOWER(value) LIKE ? or LOWER(type) LIKE ?)) AS count_row_table' at line 1 (SQL: select count(*) as aggregate from (select '1' as row from settings where (LOWER(key) LIKE %b% or LOWER(value) LIKE %b% or LOWER(type) LIKE %b%)) AS count_row_table)

— Reply to this email directly or view it on GitHub https://github.com/bllim/laravel4-datatables-package/issues/173#issuecomment-75443787 .

GiamPy5 commented 9 years ago

I have the same issue, how do I fix this?

u01jmg3 commented 8 years ago

Can any help be provided?

I found issues with both $input and $filter_columns being protected; changing them to public fixed searching for me