Data of selecting row

Data of selecting row

support@kosmos.desupport@kosmos.de 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:

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    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?

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    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) {
             dt.rows(indexes).data()
    } );
    

    Colin

Sign In or Register to comment.