3

Is it possible to change the properties of a Data-table defined during initialising based on the actions of user? I do not want to destroy() the table and create or initialise again. Is there some other method? I want to remove paging from the datatable, when a user clicks on a button

$('#example').dataTable( {
    "paging": true
} );

<button id="stopPaging"> Stop Paging<button>

I want to change to "paging":false on the click of the button. Thanks in advance.

1

1 Answer 1

1

You call disable and hide the pagination by adding below click event to your js file.

$( "#stopPaging" ).click(function() {
  $('#dataTables_paginate').find('a').each(function(e){
        $(this).off('click');
        $(this).parent().css("display","none")
    })
});

Hope this will help.

Cheers

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.