get cell value from selected row
get cell value from selected row
vansin
Posts: 15Questions: 4Answers: 0
Looking for a simple example of how to get a cell value from a selected row.
The code below gets me all of the data in the row. How could I modify this to return only the value in column 4 in the selected row?
table
.on('select', function (e, dt, type, indexes) {
var data = table.row(0).data();
events.prepend(JSON.stringify(data));
})
This discussion has been closed.
Answers
As you say,
data
contains all the data in the row. So you just need to pull out the cell's value that you want.Colin
I am a CPA by profession and not a developer so if you could elaborate on that idea that would help me out! How can I best accomplish this? Thank you!
Assuming your data is an array of data use
data[3]
(zero based indexing).Allan