• Resolved TodayOnly

    (@todayonly)


    Hi Tobias,

    I managed to get my TablePress to filter through /?table_filter=keyword1+keyword2, but I am struggling to add additional shortcode filters acting simultaneously. Say I’d also like to filter on keyword3 in the column, whilst keeping the keyword1+keyword2 filter.

    I’ve tried searching but coudlnt’d find. However I have understand this would be possible thought custom JS code that uses the API. Is that the only solution, if so, could you link me to where there′s a explanation of integrating with the API?

    https://www.ads-software.com/plugins/tablepress/

Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter TodayOnly

    (@todayonly)

    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

    Plugin Author TobiasBg

    (@tobiasbg)

    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

    Thread Starter TodayOnly

    (@todayonly)

    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

    Plugin Author TobiasBg

    (@tobiasbg)

    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

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Multiple filters simultaneously’ is closed to new replies.