• Resolved amaholo

    (@amaholo)


    Hi Tobias,

    We have just begun using your plugin on a clients site, which is working well for us and the solution. Thank you!

    Our client has asked if we could communicate with you to add a clear search button.

    I have explained that they only need click on the search to remove it, however they would like a button that clears the search in one move.

    Would you be able to add this function for us? We are willing to pay for that function…

    Many Thanks

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Just to make sure that I understood correctly: Are you referring to the dropdown that are added via the ColumnFilterWidgets Extension?

    A quick way for that might be to add this code to the page, after the [table] Shortcode:

    <script>
    jQuery( function( $ ) {
    	const clear_button = '<button class="clear-button">Clear</button>';
    	const $column_filter_widgets = $( '.column-filter-widgets' );
    	$column_filter_widgets
    		.append( clear_button )
    		.on( 'click', '.clear-button', function() {
    			column_filter_widgets.find( '.filter-term' ).click();
    		} );
    } );
    </script>

    Regards,
    Tobias

    Thread Starter amaholo

    (@amaholo)

    Hi Tobias,

    Thank you so much for the prompt response!
    I am using Divi and inserting via that channel, so no short codes are being used.

    Any other suggestion where to place the code?

    Thanks
    Quintin

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no Shortcodes are being used? That sounds strange. How is Divi finding the TablePress table then?

    Regardless, you could then paste this into a “HTML code” block that is inserted below whatever block you are using now. Or, if Divi has that, into some footer JavaScript section that only applies to that page.

    Regards,
    Tobias

    Thread Starter amaholo

    (@amaholo)

    Hi Tobias,

    I put the code in, however it was running before all other scripts had finished running which resulted in (blank) output.

    So modified the code to run as follows:

    <script>
    jQuery ( function ( $ ) {
    $(document).ready(function(){
    const clear_button = ‘<button class=”clear-button dt-button”>Clear</button>’;
    const $column_filter_widgets = $( ‘.column-filter-widgets’ );
    $column_filter_widgets
    .append( clear_button )
    .on( ‘click’, ‘.clear-button’, function() {
    $column_filter_widgets.find( ‘.filter-term’ ).click();
    } );
    });
    } );
    </script>

    Thank you for your help!
    Much appreciated!

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    ah, yes there was a typo in my code… Good to hear that you found that 🙂

    Best wishes,
    Tobias
     
    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Clear Searches list’ is closed to new replies.