ypnos-web / cakephp-datatables

CakePHP3 Plugin for DataTables plug-in for jQuery
MIT License
27 stars 24 forks source link

Filter table with integer 0 #72

Closed treyphax closed 5 years ago

treyphax commented 5 years ago

I had troubles filtering my table using a integer value of 0, as my table would get filtered with "null" instead of "0". The issue seems to come from line 184 of DataTablesComponent.php, since empty() returns true for not only "null", but also for "0" as an integer.

The issue has been resolved by replacing !empty($localSearch) with !empty($localSearch) || $localSearch === '0'

ypnos-web commented 5 years ago

Thank you for your report. I will fix this.

ypnos-web commented 5 years ago

Please let me know if the fix works for you.

treyphax commented 5 years ago

It works, thanks.