DataTables / Editor-PHP

PHP server-side libraries for Editor
Other
35 stars 22 forks source link

[BUG][FIX] Update Editor.php #6

Closed hectnandez closed 3 years ago

hectnandez commented 3 years ago

[BUG[FIX] Filter null column values on the database

Datatable generated: image Database rows: image

AllanJard commented 3 years ago

Thanks for this! I don't while understand the fix though - the condition is checking to see if a search term is submitted by the client-side. If it is, then it should be applied (which would correctly remove the null elements)?

hectnandez commented 3 years ago

ok..... found the real origin of the problem...

I'm using Laravel, and in the function \DataTables\Editor::process() I set the parameter with the \Illuminate\Http\Request::toArray() instead of the $_POST directly

\Illuminate\Http\Request::toArray() example: imagen

$_POST example: imagen

In any case, the library should filter the null values?... instead the !empty() we could use the !is_null()

AllanJard commented 3 years ago

I'm not sure how search.value is becoming null since it is submitted as an empty string. Is that Laravel doing that transformation?

hectnandez commented 3 years ago

Yes and no...

Laravel uses the library https://github.com/symfony/http-foundation to handle all the requests and responses of the framework, somehow this library replaces the empty string value with ```null```` or at least the version that I'm using right now.

Since this is not a problem of this library I'm going to close this PR.

Thanks