Get value of a column of the selected row
Get value of a column of the selected row
development@wohlsen.com
Posts: 7Questions: 2Answers: 1
I'm trying to get and use a value from the selected row. I am able to get a count of the total selected rows, but I'd like to be able to use the actual data, for instance I'd like to have javascript alert "Weekly Journal" when selecting this row. I was not able to find an example of this.
table.on( 'select', function () {
var testValue = table.rows( { selected: true } ).count();
alert(testValue);
} );
This question has accepted answers - jump to:
This discussion has been closed.
Answers
When using that line of code and doing:
alert(rowData);
the page alerts:
[object Object]
I want it to alert the value of the title column.
I got it working by adding ['title'] to the end of the line. Thanks for the help!
var rowData = table.rows( { selected: true } ).data()[0]['title'];
Yep. I did not include that part because it is completely dependent on your data structures. It couild be and array of arrays, or an array of object. As an array of objects your json naming conventions could be anything.