How to get row values using table.row( 0 ).data()

How to get row values using table.row( 0 ).data()

ns17514ns17514 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

Answers

  • allanallan Posts: 61,853Questions: 1Answers: 10,134 Site admin
    Answer ✓

    The row().data() method returns the data source object for the row. If that contains a function called name() (unlikely, but possible) you could call it as you have. If you have an object that has a name 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

This discussion has been closed.