datatables.net-keytable
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -1,3 +0,3 @@ | ||
/*! KeyTable 2.1.0 | ||
* ©2009-2015 SpryMedia Ltd - datatables.net/license | ||
/*! KeyTable 2.1.1 | ||
* ©2009-2016 SpryMedia Ltd - datatables.net/license | ||
*/ | ||
@@ -8,7 +8,7 @@ | ||
* @description Spreadsheet like keyboard navigation for DataTables | ||
* @version 2.1.0 | ||
* @version 2.1.1 | ||
* @file dataTables.keyTable.js | ||
* @author SpryMedia Ltd (www.sprymedia.co.uk) | ||
* @contact www.sprymedia.co.uk/contact | ||
* @copyright Copyright 2009-2015 SpryMedia Ltd. | ||
* @copyright Copyright 2009-2016 SpryMedia Ltd. | ||
* | ||
@@ -73,3 +73,6 @@ * This source file is free software, available under the following license: | ||
enable: true | ||
enable: true, | ||
/** @type {bool} Flag for if a draw is triggered by focus */ | ||
focusDraw: false | ||
}; | ||
@@ -183,3 +186,3 @@ | ||
// Key events | ||
$( document.body ).on( 'keydown.keyTable', function (e) { | ||
$( document ).on( 'keydown.keyTable', function (e) { | ||
that._key( e ); | ||
@@ -190,3 +193,3 @@ } ); | ||
if ( this.c.blurable ) { | ||
$( document.body ).on( 'click.keyTable', function ( e ) { | ||
$( document ).on( 'click.keyTable', function ( e ) { | ||
// Click on the search input will blur focus | ||
@@ -212,3 +215,3 @@ if ( $(e.target).parents( '.dataTables_filter' ).length ) { | ||
if ( this.c.editor ) { | ||
dt.on( 'key.kt', function ( e, dt, key, cell, orig ) { | ||
dt.on( 'key.keyTable', function ( e, dt, key, cell, orig ) { | ||
that._editor( key, orig ); | ||
@@ -227,2 +230,23 @@ } ); | ||
// Reload - re-focus on the currently selected item. In SSP mode this | ||
// has the effect of keeping the focus in position when changing page as | ||
// well (which is different from how client-side processing works). | ||
dt.on( 'xhr.keyTable', function ( e ) { | ||
if ( that.s.focusDraw ) { | ||
// Triggered by server-side processing, and thus `_focus` will | ||
// do the refocus on the next draw event | ||
return; | ||
} | ||
var lastFocus = that.s.lastFocus; | ||
if ( lastFocus ) { | ||
that.s.lastFocus = null; | ||
dt.one( 'draw', function () { | ||
that._focus( lastFocus ); | ||
} ); | ||
} | ||
} ); | ||
dt.on( 'destroy.keyTable', function () { | ||
@@ -240,3 +264,11 @@ dt.off( '.keyTable' ); | ||
if ( state && state.keyTable ) { | ||
dt.cell( state.keyTable ).focus(); | ||
// Wait until init is done | ||
dt.one( 'init', function () { | ||
var cell = dt.cell( state.keyTable ); | ||
// Ensure that the saved cell still exists | ||
if ( cell.any() ) { | ||
cell.focus(); | ||
} | ||
} ); | ||
} | ||
@@ -315,3 +347,3 @@ else if ( this.c.focus ) { | ||
// Excel style - select all text | ||
var input = $('div.DTE input'); | ||
var input = $('div.DTE input, div.DTE textarea'); | ||
if ( input.length ) { | ||
@@ -396,4 +428,7 @@ input[0].select(); | ||
if ( pageInfo.length !== -1 && (row < pageInfo.start || row >= pageInfo.start+pageInfo.length) ) { | ||
this.s.focusDraw = true; | ||
dt | ||
.one( 'draw', function () { | ||
that.s.focusDraw = false; | ||
that._focus( row, column ); | ||
@@ -705,3 +740,3 @@ } ) | ||
div.children().on( 'focus', function () { | ||
that._focus( dt.cell(':eq(0)', {page: 'current'}) ); | ||
that._focus( dt.cell(':eq(0)', '0:visible', {page: 'current'}) ); | ||
} ); | ||
@@ -767,3 +802,3 @@ } | ||
KeyTable.version = "2.1.0"; | ||
KeyTable.version = "2.1.1"; | ||
@@ -770,0 +805,0 @@ |
{ | ||
"name": "datatables.net-keytable", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "KeyTable for DataTables ", | ||
@@ -5,0 +5,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22770
718