Check whether table row is selected?

Check whether table row is selected?

xtech_devxtech_dev Posts: 25Questions: 11Answers: 0

How can I check whether single row has been selected?

var groupRowsIndexes = [1,2,3];
api.rows(groupRowsIndexes).every(function () {
    if (this.selected() /* how to check selection on row level? */) this.deselect();
    else this.select();
})

This question has an accepted answers - jump to answer

Answers

  • xtech_devxtech_dev Posts: 25Questions: 11Answers: 0
    edited August 2020

    That's the best what I came to:

    var groupRowsIndexes =  [1,2,3];
    selected = api.rows(groupRowsIndexes, { selected: true });
    api.rows(groupRowsIndexes).every(function (rowIndex) {
       if (selected[0].indexOf(rowIndex) > -1) this.deselect();
       else this.select();
    })
    
  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    Yep, that's a good way to go.

    Colin

This discussion has been closed.