DataTablesSrc icon indicating copy to clipboard operation
DataTablesSrc copied to clipboard

Fix: server-side columns().search() call passes empty string to _fnFi…

Open zeigotaro opened this issue 10 years ago • 7 comments

…lterComplete

Server-side issue, difficult to set up test page using publicly available sAjaxSource that handles DataTables-specific parameters

zeigotaro avatar Jul 14 '15 18:07 zeigotaro

Could you clarify what issue this change fixes please?

Using this example if I open the console and enter:

$('#example').DataTable().column(0).search('Airi').draw()

It correctly reduces to a single row. Then:

$('#example').DataTable().column(0).search('').draw()

correctly removes the filter.

DataTables avatar Jul 14 '15 19:07 DataTables

I'm running into an issue where, with aoColumnDefs set, settings.oPreviousSearch does not have the sSearch field set correctly. Changing that call to _fnFilterComplete to match the call used for _api_register( 'search()'...) (the function above) fixes the issue I'm seeing.

zeigotaro avatar Jul 15 '15 13:07 zeigotaro

Are you able to modify this server-side processing example to demonstrate the issue please. I don't see why defining columnDefs would make any difference to the column search API.

DataTables avatar Jul 15 '15 15:07 DataTables

Thank you for setting that example up. I've modified it, but the behavior I'm seeing on the JSBin is different than what I'm encountering (I'm using a JsonResult created with the DataTablesParser in the DataTablesDotNet library). I can workaround on my end by uncommenting that "oSettings.oPreviousSearch.sSearch" assignment. If you do not feel this is a productive fix, feel free to close. Thanks for your help. :-)

zeigotaro avatar Jul 15 '15 17:07 zeigotaro

Have you got a link to the DataTablesDotNet library? I wonder if it is a bug there.

I'd like to take the fix, but before I do I need to understand what the bug is :-).

DataTables avatar Jul 15 '15 18:07 DataTables

https://github.com/timhobbs/DataTablesDotNet is where that library is located. Thanks!

zeigotaro avatar Jul 15 '15 19:07 zeigotaro

Great thanks. I'll try to take a look before the 1.10.8 release drops.

DataTables avatar Jul 15 '15 19:07 DataTables