API
It can be useful to get information from KeyTable about the currently focused cell, which is provided by API methods. There are a number of different API methods available, and are all listed below.
fnGetCurrentData
Show details
|
Get the HTML from the currently focused cell. |
| Default: |
|
| Input parameters: |
void |
| Return parameter: |
String - HTML from the cell |
| Code example: |
$(document).ready( function () {
var oTable = $('#example').dataTable();
var keys = new KeyTable( {
"table": document.getElementById('example'),
"datatable": oTable
} );
alert( "Cell data is: "+ keys.fnGetCurrentData() );
} );
|
fnGetCurrentPosition
Show details
|
Get the coordinates of the currently focused cell in an array as [ x, y ]. |
| Default: |
|
| Input parameters: |
void |
| Return parameter: |
Array - coordinates of current focus |
| Code example: |
$(document).ready( function () {
var oTable = $('#example').dataTable();
var keys = new KeyTable( {
"table": document.getElementById('example'),
"datatable": oTable
} );
var a = keys.fnGetCurrentPosition();
...
} );
|
fnGetCurrentTD
Show details
|
Get the TD node for the currently focused cell. |
| Default: |
|
| Input parameters: |
void |
| Return parameter: |
Node - currently focused cell |
| Code example: |
$(document).ready( function () {
var oTable = $('#example').dataTable();
var keys = new KeyTable( {
"table": document.getElementById('example'),
"datatable": oTable
} );
var node = keys.fnGetCurrentTD();
...
} );
|
fnSetPosition
Show details
|
Get the coordinates of the table's focus programatically. |
| Default: |
|
| Input parameters: |
$(document).ready( function () {
var oTable = $('#example').dataTable();
var keys = new KeyTable( {
"table": document.getElementById('example'),
"datatable": oTable
} );
keys.fnSetPosition( 1, 1 );
} ); |
| Return parameter: |
void |
| Code example: |
- int - x-coordinate
- int - y-coordinate
|