How to get row values using table.row( 0 ).data()
How to get row values using table.row( 0 ).data()
ns17514
Posts: 3Questions: 3Answers: 0
// Create table with data set
var table = $('#example').DataTable( {
data: pupils
} );
var row1 = table.row( 0 ).data();
alert( 'Pupil name in the first row is: '+ row1.name() );
After the table is loaded the column value of row1 shown as undefined .!
in row1.name() what name() mean?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The
row().data()
method returns the data source object for the row. If that contains a function calledname()
(unlikely, but possible) you could call it as you have. If you have an object that has aname
property you could just use.name
. If it is an array, access it like an array.I can't say for certain what method you want to use, as no test case has been provided (as is required in the forum rules).
Allan