Datatables traversal
Datatables traversal
I am trying to get the next row in a datatable, below the row that I have currently clicked on. What I am seeing is that the row returned is based on a sorted collection of the first row and not the way the table is displayed on the page.
The table is defined as:
[code]
{
"sScrollY": "400px",
"bScrollCollapse": true,
"bPaginate": false,
"bLengthChange": true,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bAutoWidth": true
}
[/code]
And I am trying to get the next row based on the following code:
[code]
// Get the position of the current data from the node
var posn = table.fnGetPosition( currentRow );
// Get the settings object associated with the table
var oSettings = table.fnSettings();
if (posn < oSettings._iDisplayEnd){
return table.fnGetNodes( posn + 1 );
}
[/code]
Any suggestions on how to do this would be much appreciated.
The table is defined as:
[code]
{
"sScrollY": "400px",
"bScrollCollapse": true,
"bPaginate": false,
"bLengthChange": true,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bAutoWidth": true
}
[/code]
And I am trying to get the next row based on the following code:
[code]
// Get the position of the current data from the node
var posn = table.fnGetPosition( currentRow );
// Get the settings object associated with the table
var oSettings = table.fnSettings();
if (posn < oSettings._iDisplayEnd){
return table.fnGetNodes( posn + 1 );
}
[/code]
Any suggestions on how to do this would be much appreciated.
This discussion has been closed.
Replies
Allan
That's great news! Unfortunately, I can't get that to work. I keep getting an exception when calling the fnGetAdjacentTr API:
[code]
Uncaught TypeError: Object [object Object] has no method 'fnGetAdjacentTr'
[/code]
I am calling that function as:
[code]
nextRow = table.fnGetAdjacentTr( currentRow );
[/code]
Here is how I am trying to include that API on the page:
[code]
[/code]
I have also tried to include it as:
[code]
[/code]
Neither approach seems to work. How do I go about using this API?
Thanks!
Allan
Allan