SelectAll error

SelectAll error

flanderboyflanderboy Posts: 3Questions: 2Answers: 0
edited July 2019 in Free community support

Hello everyone
I have a problem.
I put the button selectAll, on my datatable

buttons: [
        'selectAll',
        'selectNone'
]

I have 20 rows but the length is 10. If i press SelectAll if I looping selected rows

table.rows({selected: true}).every()

I see only 10 index but the

table.rows({selected: true}).indexes().length

is 20

But if i go to page 2 and back to page 1 the

table.rows({selected: true}).every()

is 20

Any idea?

Stefano

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,147Questions: 26Answers: 4,918
    Answer ✓

    Are you using Server Side Processing?

    What you are doing seems to work here:
    http://live.datatables.net/bamuguwa/1/edit

    If you are using server side processing then the behavior you describe seems accurate since only the rows being displayed are in the client and "selectable". If not then please update the example to replicate your issue.

    Kevin

  • flanderboyflanderboy Posts: 3Questions: 2Answers: 0

    thank you for your answer,
    the process is client-side, if I run you example I see all selected row in Array.

    But I using this way to select all rows after a click on other button in the page

    table.rows({selected: true}).every(function (rowIdx, tableLoop, rowLoop) {
    
        var node        = this.node();
        console.log($(node).attr('id'));
    
    });
    
  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @flanderboy ,

    I don't quite follow. Would you be able to modify Kevin's example to demonstrate the issue, please.

    Cheers,

    Colin

This discussion has been closed.