How to get from selected row the value of field in the editor?

How to get from selected row the value of field in the editor?

sandramytsandramyt Posts: 1Questions: 1Answers: 0

Hi,

I'm new using datables and I'm having some trouble to get from the selected row the value of certain column.

What I have right now is:

table.row({ selected: true })

How can I get from there the value as a string of the first column?

Thanks in advance! :)

Answers

  • allanallan Posts: 63,871Questions: 1Answers: 10,525 Site admin

    Two options:

    // 1. Get data object for whole row and then access the property / index from there
    var data = table.row( { selected: true } ).data();
    
    // 2. Use cell().data()
    var rowIdx = table.row( {selected: true } ).index();
    var cellData = table.cell( rowIdx, 0 ).data();
    

    Allan

This discussion has been closed.