KeyTable v1.2.0
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.
fnBlur Show details
|
Blur focus from the table programmatically |
Default: |
|
Input parameters: |
void |
Return parameter: |
void |
Code example: |
$(document).ready( function () {
var oTable = $('#example').dataTable();
var keys = new $.fn.dataTable.KeyTable( oTable );
keys.fnSetPosition( 1, 1 );
keys.fnBlur(); // A bit pointless here, but it shows the use!
} );
|
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 $.fn.dataTable.KeyTable( 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 $.fn.dataTable.KeyTable( 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 $.fn.dataTable.KeyTable( oTable );
var node = keys.fnGetCurrentTD();
...
} );
|
fnSetPosition Show details
|
Set the coordinates of the table's focus programatically. |
Default: |
|
Input parameters: |
$(document).ready( function () {
var oTable = $('#example').dataTable();
var keys = new $.fn.dataTable.KeyTable( oTable );
keys.fnSetPosition( 1, 1 );
} ); |
Return parameter: |
void |
Code example: |
- int - x-coordinate
- int - y-coordinate
|