.rows() method returns unexpected result

.rows() method returns unexpected result

walruswalrus Posts: 5Questions: 2Answers: 0

I have my DataTable, like that:

var myData = [
    {item: 'apple', color: 'red'},
  {item: 'pear', color: 'green'},
  {item: 'pinaple', color: 'yellow'},
  {item: 'banana', color: 'yellow'}
];

var dataTable = $('#mytable').DataTable({
    sDom: 't',
  data: myData,
  columns: [
    {data: 'item', title: 'item'},
    {data: 'color', title: 'color'}
  ]
});

var selectedRow = dataTable.rows(1,{order:'applied'}).data();
$('#requested').text(JSON.stringify(selectedRow[0]));

And the question is why .rows(1, {order:'applied'}) refers to the second row of source data set and not actual current table layout?

Here is a playground.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.