• Resolved sesselschwitzer

    (@sesselschwitzer)


    Hello,

    I have written a short jQuery function to add a close button to the end of the search input field. After clicking the close button the input field will be cleared BUT the table does not refresh. What is missing?

    jQuery(document).ready(function($) {
    
    	// Force delayed execution of jQuery
        setTimeout(function() {
    
    		// Add button-link to the end of the input field.
    		var c = 'fa fa-times';
    		var s = 'border: 0px; position: absolute; margin-left: -20px; margin-top: 15px; cursor: pointer;';
    		var button = '<a class="' + c + '" style="' + s + '"></a>';
    		jQuery('div.dataTables_filter > label').append(button);
    
    		// Empty input field on button click.
    		jQuery('div.dataTables_filter > label > a').click(function(){
    			jQuery('div.dataTables_filter > label > input[type="search"]').val('');
    		// Refresh table:
    		// ...
    		});
    
        }, 0);
    });

    For your information:
    The setTimeout() is needed otherwise the script will not execute.

    Cheers
    Sascha

Viewing 16 replies (of 16 total)
Viewing 16 replies (of 16 total)

The topic ‘Refresh table’ is closed to new replies.