datatables.net-select
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -1,2 +0,2 @@ | ||
/*! Select for DataTables 1.2.0 | ||
/*! Select for DataTables 1.2.1 | ||
* 2015-2016 SpryMedia Ltd - datatables.net/license/mit | ||
@@ -9,3 +9,3 @@ */ | ||
* that provides selection options of the items in a DataTable | ||
* @version 1.2.0 | ||
* @version 1.2.1 | ||
* @file dataTables.select.js | ||
@@ -58,3 +58,3 @@ * @author SpryMedia Ltd (www.sprymedia.co.uk) | ||
DataTable.select.version = '1.2.0'; | ||
DataTable.select.version = '1.2.1'; | ||
@@ -76,2 +76,3 @@ DataTable.select.init = function ( dt ) { | ||
var className = 'selected'; | ||
var setStyle = false; | ||
@@ -83,5 +84,7 @@ ctx._select = {}; | ||
style = 'os'; | ||
setStyle = true; | ||
} | ||
else if ( typeof opts === 'string' ) { | ||
style = opts; | ||
setStyle = true; | ||
} | ||
@@ -103,2 +106,3 @@ else if ( $.isPlainObject( opts ) ) { | ||
style = opts.style; | ||
setStyle = true; | ||
} | ||
@@ -137,3 +141,3 @@ | ||
// class name, then enable | ||
if ( $( dt.table().node() ).hasClass( 'selectable' ) ) { | ||
if ( ! setStyle && $( dt.table().node() ).hasClass( 'selectable' ) ) { | ||
dt.select.style( 'os' ); | ||
@@ -310,3 +314,3 @@ } | ||
$( dt.table().body() ) | ||
$( dt.table().container() ) | ||
.off( 'mousedown.dtSelect', selector ) | ||
@@ -327,7 +331,7 @@ .off( 'mouseup.dtSelect', selector ) | ||
{ | ||
var body = $( dt.table().body() ); | ||
var container = $( dt.table().container() ); | ||
var ctx = dt.settings()[0]; | ||
var selector = ctx._select.selector; | ||
body | ||
container | ||
.on( 'mousedown.dtSelect', selector, function(e) { | ||
@@ -337,3 +341,3 @@ // Disallow text selection for shift clicking on the table so multi | ||
if ( e.shiftKey || e.metaKey || e.ctrlKey ) { | ||
body | ||
container | ||
.css( '-moz-user-select', 'none' ) | ||
@@ -348,3 +352,3 @@ .one('selectstart.dtSelect', selector, function () { | ||
// 35.0.1 - still required) | ||
body.css( '-moz-user-select', '' ); | ||
container.css( '-moz-user-select', '' ); | ||
} ) | ||
@@ -1013,2 +1017,11 @@ .on( 'click.dtSelect', selector, function ( e ) { | ||
// Common events with suitable namespaces | ||
function namespacedEvents ( config ) { | ||
var unique = config._eventNamespace; | ||
return 'draw.dt.DT'+unique+' select.dt.DT'+unique+' deselect.dt.DT'+unique; | ||
} | ||
var _buttonNamespace = 0; | ||
$.extend( DataTable.ext.buttons, { | ||
@@ -1018,8 +1031,9 @@ selected: { | ||
className: 'buttons-selected', | ||
init: function ( dt ) { | ||
init: function ( dt, node, config ) { | ||
var that = this; | ||
config._eventNamespace = '.select'+(_buttonNamespace++); | ||
// .DT namespace listeners are removed by DataTables automatically | ||
// on table destroy | ||
dt.on( 'draw.dt.DT select.dt.DT deselect.dt.DT', function () { | ||
dt.on( namespacedEvents(config), function () { | ||
var enable = that.rows( { selected: true } ).any() || | ||
@@ -1033,2 +1047,5 @@ that.columns( { selected: true } ).any() || | ||
this.disable(); | ||
}, | ||
destroy: function ( dt, node, config ) { | ||
dt.off( config._eventNamespace ); | ||
} | ||
@@ -1039,6 +1056,7 @@ }, | ||
className: 'buttons-selected-single', | ||
init: function ( dt ) { | ||
init: function ( dt, node, config ) { | ||
var that = this; | ||
config._eventNamespace = '.select'+(_buttonNamespace++); | ||
dt.on( 'draw.dt.DT select.dt.DT deselect.dt.DT', function () { | ||
dt.on( namespacedEvents(config), function () { | ||
var count = dt.rows( { selected: true } ).flatten().length + | ||
@@ -1052,2 +1070,5 @@ dt.columns( { selected: true } ).flatten().length + | ||
this.disable(); | ||
}, | ||
destroy: function ( dt, node, config ) { | ||
dt.off( config._eventNamespace ); | ||
} | ||
@@ -1069,6 +1090,7 @@ }, | ||
}, | ||
init: function ( dt ) { | ||
init: function ( dt, node, config ) { | ||
var that = this; | ||
config._eventNamespace = '.select'+(_buttonNamespace++); | ||
dt.on( 'draw.dt.DT select.dt.DT deselect.dt.DT', function () { | ||
dt.on( namespacedEvents(config), function () { | ||
var count = dt.rows( { selected: true } ).flatten().length + | ||
@@ -1082,2 +1104,5 @@ dt.columns( { selected: true } ).flatten().length + | ||
this.disable(); | ||
}, | ||
destroy: function ( dt, node, config ) { | ||
dt.off( config._eventNamespace ); | ||
} | ||
@@ -1084,0 +1109,0 @@ } |
{ | ||
"name": "datatables.net-select", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Select 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
33903
934