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
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
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
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!
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!