Hi Tobias,
Thank you for the quick respond.
I tried copy & paste that code into the tablepress-datatables-button-filter.php
First, I replaced the $( '#tablepress-{$table_id}_filter input' ).val() + ' ' + $( this ).data( 'filterterm' ) with the new code.
This didn’t work, so I kept the old code and put the new code below.
This didn’t work either. So I deleted the whole
var {$name} = {$command};
$( 'body' ).on( 'click', '.table-{$table_id}-filter', function() {
{$name}.search( $( '#tablepress-{$table_id}_filter input' ).val() + ' ' + $( this ).data( 'filterterm' ) ).draw();
} );
and replaced with your code.
However, this didn’t work either.
Where is this code supposed to be?
Kind regards
Hi,
the full code should look like this
var {$name} = {$command};
$( 'body' ).on( 'click', '.table-{$table_id}-filter', function() {
var filter_term = '';
if ( '#reset#' !== $( this ).data( 'filterterm' ) ) {
filter_term = $( '#tablepress-{$table_id}_filter input' ).val() + ' ' + $( this ).data( 'filterterm' );
}
{$name}.search( filter_term ).draw();
} );
Regards,
Tobias
Hi Tobias,
That worked wonderfully. Thank you.
However, now we have a button that resets all filters. What we both agreed on that is best solution is if the button can be switched on/switched off.
Is there a way to do that?
Again, I am in no hurry so if such an feature would require extra time, I’m happy with that, but that is what we both think is the best.
Kind regards
Hi,
the JS code is pretty flexible, so I don’t see a reason why this should not be possible.
Unfortunately, that’s now really beyond the support that I can offer, I’m really sorry.
I hope that the code with the “Reset All” button can maybe be a good starting point for writing custom code for this now.
Regards,
Tobias