Data table, select all pages (Table has 1,2, 3.. n pages) when clicked on Select all button

Data table, select all pages (Table has 1,2, 3.. n pages) when clicked on Select all button

nareshwernareshwer Posts: 4Questions: 1Answers: 0

Hi,

When clicked on select all pages button I am getting all the rows available in data table and changing the bg color for all rows, but when user goes to next page records are not selected, only first page records are selected.

How to select all the pages when clicked on select button.

Answers

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Hm, interesting... Does the select all on the example work for you? It works for me, as well as my installation of the select, I can select all and it selects all on all the pages.

    Do this really quick if you can, to help us debug it: https://debug.datatables.net/

  • nareshwernareshwer Posts: 4Questions: 1Answers: 0

    Hi jLinux,

    Sorry for the late reply, I have tried other ways to do it but could not do it, here is the 6 letter code ukepic generated form DataTable debug for your ref.

    Thanks in Advance.

  • nareshwernareshwer Posts: 4Questions: 1Answers: 0

    this is code iam using for row bg color change.

    for(var k = 0; k < this.Search.searchResult.dataRows.length; k++)
    {
    var rowid = this.Search.searchResult.dataRows[k][0];

        $('#'+rowid).children('td, th').css('background-color','#259aa2');
        $('#'+rowid).children('td, th').css('color','#fff');
        }
    
  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Wait, youre using your own code to select them and/or change the bg colors?

  • nareshwernareshwer Posts: 4Questions: 1Answers: 0

    yes, the code given in the previous post.

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Well that definitely wont work... You have to use the DataTables API or the select button... DataTables literally removes the rows that arent visible from the DOM, so you wont be able to select them, since your code is going through the DOM..

    Just use the select.

This discussion has been closed.