Data of selecting row

Data of selecting row Posts: 16Questions: 7Answers: 0

I feel like this is redundant. Can i find the data of the row withou calling the inner function?

tabellePlan.on( 'select', function () {
         tabellePlan.rows({selected:  true}).data()
} );

This question has accepted answers - jump to:


  • kthorngrenkthorngren Posts: 19,891Questions: 26Answers: 4,691
    edited May 2022 Answer ✓

    Its not redundant. Line 1 is the select event handler. In the handler that executes when a row is selected. Line 2 uses the rows().data() API. The selector-modifier of {selected: true} filters the rows returned from the rows() API to those that are selected. You can use tabellePlan.rows({selected: true}).data() at anytime, it doesn't need to be within the select event.

    Does this address your concern?


  • colincolin Posts: 15,094Questions: 1Answers: 2,581
    edited May 2022 Answer ✓

    As Kevin said, but it's also worth noting that select passed the indexes of the selected items into your function, so you can do something like this;

    tabellePlan.on( 'select', function (e, dt, type, indexes) {
    } );


Sign In or Register to comment.