Key navigation
Key navigation
I added som feature to the script....im not a professional with js so it can be more simple as this...
i added to jquery.dataTables.js some extra lines starting line 264...
[code]/* added left key function */
$().keypress(function (e) {
if (e.keyCode == 37) {
oSettings._iDisplayStart -= oSettings._iDisplayLength;
/* Correct for underrun */
if ( oSettings._iDisplayStart < 0 )
{
oSettings._iDisplayStart = 0;
}
fnCallbackDraw( oSettings );
}
});
/* added right key function */
$().keypress(function (e) {
if (e.keyCode == 39) {
/* Make sure we are not over running the display array */
if ( oSettings._iDisplayStart + oSettings._iDisplayLength < oSettings.fnRecordsDisplay() )
{
oSettings._iDisplayStart += oSettings._iDisplayLength;
}
fnCallbackDraw( oSettings );
}
});[/code]
its a feature that enable listing with left or right arrow on keyboard... i hope it can be usefull for somebody...
i added to jquery.dataTables.js some extra lines starting line 264...
[code]/* added left key function */
$().keypress(function (e) {
if (e.keyCode == 37) {
oSettings._iDisplayStart -= oSettings._iDisplayLength;
/* Correct for underrun */
if ( oSettings._iDisplayStart < 0 )
{
oSettings._iDisplayStart = 0;
}
fnCallbackDraw( oSettings );
}
});
/* added right key function */
$().keypress(function (e) {
if (e.keyCode == 39) {
/* Make sure we are not over running the display array */
if ( oSettings._iDisplayStart + oSettings._iDisplayLength < oSettings.fnRecordsDisplay() )
{
oSettings._iDisplayStart += oSettings._iDisplayLength;
}
fnCallbackDraw( oSettings );
}
});[/code]
its a feature that enable listing with left or right arrow on keyboard... i hope it can be usefull for somebody...
This discussion has been closed.
Replies
Good one! Thanks for posting that. I've done something a bit similar for a paging plugin function ( http://datatables.net/plug-ins/pagination ) - but you need to be focused on the input box in mine, rather than the global handler you have.
Thanks for sharing!
Allan