Multiple filters in a single column. Not all filter fields posting to ajax source.
Multiple filters in a single column. Not all filter fields posting to ajax source.
dkantala
Posts: 1Questions: 0Answers: 0
Version: 1.7.6
Using Ajax data source
I turned off (hide) global filtering and instead have a filter box in each column. For my date columns, I added two filter fields from and to. DataTables is posting sSearch data for the number of columns, not the number of actual filter fields.
In this particular case I have 16 columns with 19 filter fields
My fix was to add the following code to the datatable initialization for the missing filters.
aoData.push( { "name": "sSearch_17", "value": cleanFilter($('#search_17').val()) } );
aoData.push( { "name": "sSearch_18", "value": cleanFilter($('#search_18').val()) } );
aoData.push( { "name": "sSearch_19", "value": cleanFilter($('#search_19').val()) } );
Using Ajax data source
I turned off (hide) global filtering and instead have a filter box in each column. For my date columns, I added two filter fields from and to. DataTables is posting sSearch data for the number of columns, not the number of actual filter fields.
In this particular case I have 16 columns with 19 filter fields
My fix was to add the following code to the datatable initialization for the missing filters.
aoData.push( { "name": "sSearch_17", "value": cleanFilter($('#search_17').val()) } );
aoData.push( { "name": "sSearch_18", "value": cleanFilter($('#search_18').val()) } );
aoData.push( { "name": "sSearch_19", "value": cleanFilter($('#search_19').val()) } );
This discussion has been closed.
Replies
Allan