jquery-datatables-rails 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/dataTables/bootstrap/2/jquery.dataTables.bootstrap.js +110 -96
  3. data/app/assets/javascripts/dataTables/bootstrap/3/jquery.dataTables.bootstrap.js +6 -6
  4. data/app/assets/javascripts/dataTables/extras/dataTables.colReorder.js +28 -27
  5. data/app/assets/javascripts/dataTables/extras/dataTables.colVis.js +27 -11
  6. data/app/assets/javascripts/dataTables/extras/dataTables.fixedColumns.js +53 -29
  7. data/app/assets/javascripts/dataTables/extras/dataTables.responsive.js +110 -47
  8. data/app/assets/javascripts/dataTables/extras/dataTables.tableTools.js +90 -25
  9. data/app/assets/javascripts/dataTables/jquery.dataTables.foundation.js +133 -139
  10. data/app/assets/javascripts/dataTables/jquery.dataTables.js +483 -375
  11. data/app/assets/javascripts/dataTables/jquery.dataTables.sorting.numbersHtml.js +37 -14
  12. data/app/assets/javascripts/dataTables/jquery.dataTables.typeDetection.numbersHtml.js +49 -33
  13. data/app/assets/media/dataTables/extras/swf/copy_csv_xls.swf +0 -0
  14. data/app/assets/media/dataTables/extras/swf/copy_csv_xls_pdf.swf +0 -0
  15. data/app/assets/stylesheets/dataTables/bootstrap/2/jquery.dataTables.bootstrap.scss +34 -9
  16. data/app/assets/stylesheets/dataTables/bootstrap/3/jquery.dataTables.bootstrap.scss +122 -31
  17. data/app/assets/stylesheets/dataTables/extras/dataTables.colvis.jqueryui.scss +18 -0
  18. data/app/assets/stylesheets/dataTables/extras/dataTables.fixedColumns.scss +1 -0
  19. data/app/assets/stylesheets/dataTables/extras/dataTables.responsive.scss +29 -12
  20. data/app/assets/stylesheets/dataTables/extras/dataTables.tableTools.scss +43 -19
  21. data/app/assets/stylesheets/dataTables/jquery.dataTables.foundation.scss +15 -4
  22. data/app/assets/stylesheets/dataTables/jquery.dataTables.scss +22 -11
  23. data/lib/jquery/datatables/rails/version.rb +1 -1
  24. metadata +18 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 438f6815ac6132f53eccd23fef2b339d1180304f
4
- data.tar.gz: ee24ce1f00c2392c8371d23420d3395808edf3cb
3
+ metadata.gz: ad30fc9e7f7a606ff47490f39e286574de688d5a
4
+ data.tar.gz: f92ef5aad051fbcecb88dc0720a70f2c628a7b07
5
5
  SHA512:
6
- metadata.gz: 86a865b15943138c42ad50ebba7064b224e96463eefada00caf6d773c56c90eb1a5dea7ae9b9cf2d38b800742fc45d50db1445764412ab30b6cfebc0996d718d
7
- data.tar.gz: a505dc019758683bde90badc52be82a4162e9abe9b5c6cf9cb1f53248742fe9912d7f6f9ef4a44a449706ab9cdd43cc3fc2c6c2470b8c52917c5055eee0897f9
6
+ metadata.gz: b66d96926f2ad06cfefbb6321fe9c5dd72c0c264359769e9c8bb9dab8742978f1d71407f69545053ad61eb06715433fc502b8cbc673e88cc033691eebd2281f7
7
+ data.tar.gz: a9e6a1fc77213de678c689b633e3c7d80be50b383026e303b61f2f0a751b149aea575351dbb88ac31c9b768fe3ef4bf214fcf73aac431b64ae12a89299bb63a1
@@ -1,121 +1,133 @@
1
- /* Set the defaults for DataTables initialisation */
2
- $.extend( true, $.fn.dataTable.defaults, {
3
- "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
4
- "sPaginationType": "bootstrap",
5
- "oLanguage": {
6
- "sLengthMenu": "_MENU_ records per page"
7
- }
1
+ /*! DataTables Bootstrap 2 integration
2
+ * ©2011-2014 SpryMedia Ltd - datatables.net/license
3
+ */
4
+
5
+ /**
6
+ * DataTables integration for Bootstrap 2. This requires Bootstrap 2 and
7
+ * DataTables 1.10 or newer.
8
+ *
9
+ * This file sets the defaults and adds options to DataTables to style its
10
+ * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap
11
+ * for further information.
12
+ */
13
+ (function(window, document, $, DataTable, undefined){
14
+
15
+ $.extend( true, DataTable.defaults, {
16
+ "dom":
17
+ "<'row-fluid'<'span6'l><'span6'f>r>" +
18
+ "<'row-fluid'<'span12't>>" +
19
+ "<'row-fluid'<'span6'i><'span6'p>>",
20
+ renderer: 'bootstrap'
8
21
  } );
9
22
 
10
23
 
11
24
  /* Default class modification */
12
- $.extend( $.fn.dataTableExt.oStdClasses, {
13
- "sWrapper": "dataTables_wrapper form-inline"
25
+ $.extend( DataTable.ext.classes, {
26
+ sWrapper: "dataTables_wrapper form-inline dt-bootstrap"
14
27
  } );
15
28
 
16
29
 
17
- /* API method to get paging information */
18
- $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
19
- {
20
- return {
21
- "iStart": oSettings._iDisplayStart,
22
- "iEnd": oSettings.fnDisplayEnd(),
23
- "iLength": oSettings._iDisplayLength,
24
- "iTotal": oSettings.fnRecordsTotal(),
25
- "iFilteredTotal": oSettings.fnRecordsDisplay(),
26
- "iPage": oSettings._iDisplayLength === -1 ?
27
- 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
28
- "iTotalPages": oSettings._iDisplayLength === -1 ?
29
- 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
30
- };
31
- };
32
-
33
-
34
- /* Bootstrap style pagination control */
35
- $.extend( $.fn.dataTableExt.oPagination, {
36
- "bootstrap": {
37
- "fnInit": function( oSettings, nPaging, fnDraw ) {
38
- var oLang = oSettings.oLanguage.oPaginate;
39
- var fnClickHandler = function ( e ) {
40
- e.preventDefault();
41
- if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) {
42
- fnDraw( oSettings );
43
- }
44
- };
45
-
46
- $(nPaging).addClass('pagination').append(
47
- '<ul>'+
48
- '<li class="prev disabled"><a href="#">&larr; '+oLang.sPrevious+'</a></li>'+
49
- '<li class="next disabled"><a href="#">'+oLang.sNext+' &rarr; </a></li>'+
50
- '</ul>'
51
- );
52
- var els = $('a', nPaging);
53
- $(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
54
- $(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
55
- },
56
-
57
- "fnUpdate": function ( oSettings, fnDraw ) {
58
- var iListLength = 5;
59
- var oPaging = oSettings.oInstance.fnPagingInfo();
60
- var an = oSettings.aanFeatures.p;
61
- var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
30
+ /* Bootstrap paging button renderer */
31
+ DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
32
+ var api = new DataTable.Api( settings );
33
+ var classes = settings.oClasses;
34
+ var lang = settings.oLanguage.oPaginate;
35
+ var btnDisplay, btnClass;
62
36
 
63
- if ( oPaging.iTotalPages < iListLength) {
64
- iStart = 1;
65
- iEnd = oPaging.iTotalPages;
66
- }
67
- else if ( oPaging.iPage <= iHalf ) {
68
- iStart = 1;
69
- iEnd = iListLength;
70
- } else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
71
- iStart = oPaging.iTotalPages - iListLength + 1;
72
- iEnd = oPaging.iTotalPages;
73
- } else {
74
- iStart = oPaging.iPage - iHalf + 1;
75
- iEnd = iStart + iListLength - 1;
37
+ var attach = function( container, buttons ) {
38
+ var i, ien, node, button;
39
+ var clickHandler = function ( e ) {
40
+ e.preventDefault();
41
+ if ( !$(e.currentTarget).hasClass('disabled') ) {
42
+ api.page( e.data.action ).draw( false );
76
43
  }
44
+ };
77
45
 
78
- for ( i=0, ien=an.length ; i<ien ; i++ ) {
79
- // Remove the middle elements
80
- $('li:gt(0)', an[i]).filter(':not(:last)').remove();
81
-
82
- // Add the new list items and their event handlers
83
- for ( j=iStart ; j<=iEnd ; j++ ) {
84
- sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
85
- $('<li '+sClass+'><a href="#">'+j+'</a></li>')
86
- .insertBefore( $('li:last', an[i])[0] )
87
- .bind('click', function (e) {
88
- e.preventDefault();
89
- oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
90
- fnDraw( oSettings );
91
- } );
92
- }
46
+ for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
47
+ button = buttons[i];
93
48
 
94
- // Add / remove disabled classes from the static elements
95
- if ( oPaging.iPage === 0 ) {
96
- $('li:first', an[i]).addClass('disabled');
97
- } else {
98
- $('li:first', an[i]).removeClass('disabled');
49
+ if ( $.isArray( button ) ) {
50
+ attach( container, button );
51
+ }
52
+ else {
53
+ btnDisplay = '';
54
+ btnClass = '';
55
+
56
+ switch ( button ) {
57
+ case 'ellipsis':
58
+ btnDisplay = '&hellip;';
59
+ btnClass = 'disabled';
60
+ break;
61
+
62
+ case 'first':
63
+ btnDisplay = lang.sFirst;
64
+ btnClass = button + (page > 0 ?
65
+ '' : ' disabled');
66
+ break;
67
+
68
+ case 'previous':
69
+ btnDisplay = lang.sPrevious;
70
+ btnClass = button + (page > 0 ?
71
+ '' : ' disabled');
72
+ break;
73
+
74
+ case 'next':
75
+ btnDisplay = lang.sNext;
76
+ btnClass = button + (page < pages-1 ?
77
+ '' : ' disabled');
78
+ break;
79
+
80
+ case 'last':
81
+ btnDisplay = lang.sLast;
82
+ btnClass = button + (page < pages-1 ?
83
+ '' : ' disabled');
84
+ break;
85
+
86
+ default:
87
+ btnDisplay = button + 1;
88
+ btnClass = page === button ?
89
+ 'active' : '';
90
+ break;
99
91
  }
100
92
 
101
- if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
102
- $('li:last', an[i]).addClass('disabled');
103
- } else {
104
- $('li:last', an[i]).removeClass('disabled');
93
+ if ( btnDisplay ) {
94
+ node = $('<li>', {
95
+ 'class': classes.sPageButton+' '+btnClass,
96
+ 'aria-controls': settings.sTableId,
97
+ 'tabindex': settings.iTabIndex,
98
+ 'id': idx === 0 && typeof button === 'string' ?
99
+ settings.sTableId +'_'+ button :
100
+ null
101
+ } )
102
+ .append( $('<a>', {
103
+ 'href': '#'
104
+ } )
105
+ .html( btnDisplay )
106
+ )
107
+ .appendTo( container );
108
+
109
+ settings.oApi._fnBindAction(
110
+ node, {action: button}, clickHandler
111
+ );
105
112
  }
106
113
  }
107
114
  }
108
- }
109
- } );
115
+ };
116
+
117
+ attach(
118
+ $(host).empty().html('<div class="pagination"><ul/></div>').find('ul'),
119
+ buttons
120
+ );
121
+ };
110
122
 
111
123
 
112
124
  /*
113
125
  * TableTools Bootstrap compatibility
114
126
  * Required TableTools 2.1+
115
127
  */
116
- if ( $.fn.DataTable.TableTools ) {
128
+ if ( DataTable.TableTools ) {
117
129
  // Set the classes that TableTools uses to something suitable for Bootstrap
118
- $.extend( true, $.fn.DataTable.TableTools.classes, {
130
+ $.extend( true, DataTable.TableTools.classes, {
119
131
  "container": "DTTT btn-group",
120
132
  "buttons": {
121
133
  "normal": "btn",
@@ -137,7 +149,7 @@ if ( $.fn.DataTable.TableTools ) {
137
149
  } );
138
150
 
139
151
  // Have the collection use a bootstrap compatible dropdown
140
- $.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, {
152
+ $.extend( true, DataTable.TableTools.DEFAULTS.oTags, {
141
153
  "collection": {
142
154
  "container": "ul",
143
155
  "button": "li",
@@ -146,3 +158,5 @@ if ( $.fn.DataTable.TableTools ) {
146
158
  } );
147
159
  }
148
160
 
161
+
162
+ })(window, document, jQuery, jQuery.fn.dataTable);
@@ -1,4 +1,4 @@
1
- /*! DataTables Bootstrap integration
1
+ /*! DataTables Bootstrap 3 integration
2
2
  * ©2011-2014 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -19,9 +19,9 @@ var factory = function( $, DataTable ) {
19
19
  /* Set the defaults for DataTables initialisation */
20
20
  $.extend( true, DataTable.defaults, {
21
21
  dom:
22
- "<'row'<'col-xs-6'l><'col-xs-6'f>r>"+
23
- "t"+
24
- "<'row'<'col-xs-6'i><'col-xs-6'p>>",
22
+ "<'row'<'col-sm-6'l><'col-sm-6'f>>" +
23
+ "<'row'<'col-sm-12'tr>>" +
24
+ "<'row'<'col-sm-5'i><'col-sm-7'p>>",
25
25
  renderer: 'bootstrap'
26
26
  } );
27
27
 
@@ -45,7 +45,7 @@ DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, bu
45
45
  var i, ien, node, button;
46
46
  var clickHandler = function ( e ) {
47
47
  e.preventDefault();
48
- if ( e.data.action !== 'ellipsis' ) {
48
+ if ( !$(e.currentTarget).hasClass('disabled') ) {
49
49
  api.page( e.data.action ).draw( false );
50
50
  }
51
51
  };
@@ -148,7 +148,7 @@ if ( DataTable.TableTools ) {
148
148
  }
149
149
  },
150
150
  "print": {
151
- "info": "DTTT_print_info modal"
151
+ "info": "DTTT_print_info"
152
152
  },
153
153
  "select": {
154
154
  "row": "active"
@@ -1,11 +1,11 @@
1
- /*! ColReorder 1.1.2
1
+ /*! ColReorder 1.1.3
2
2
  * ©2010-2014 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
5
  /**
6
6
  * @summary ColReorder
7
7
  * @description Provide the ability to reorder columns in a DataTable
8
- * @version 1.1.2
8
+ * @version 1.1.3
9
9
  * @file dataTables.colReorder.js
10
10
  * @author SpryMedia Ltd (www.sprymedia.co.uk)
11
11
  * @contact www.sprymedia.co.uk/contact
@@ -90,13 +90,8 @@ function fnDomSwitch( nParent, iFrom, iTo )
90
90
 
91
91
 
92
92
 
93
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
94
- * DataTables plug-in API functions
95
- *
96
- * This are required by ColReorder in order to perform the tasks required, and also keep this
97
- * code portable, to be used for other column reordering projects with DataTables, if needed.
98
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
99
-
93
+ var factory = function( $, DataTable ) {
94
+ "use strict";
100
95
 
101
96
  /**
102
97
  * Plug-in for DataTables which will reorder the internal column structure by taking the column
@@ -344,10 +339,6 @@ $.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo )
344
339
  };
345
340
 
346
341
 
347
-
348
- var factory = function( $, DataTable ) {
349
- "use strict";
350
-
351
342
  /**
352
343
  * ColReorder provides column visibility control for DataTables
353
344
  * @class ColReorder
@@ -390,6 +381,11 @@ var ColReorder = function( dt, opts )
390
381
  oDTSettings = dt;
391
382
  }
392
383
 
384
+ // Ensure that we can't initialise on the same table twice
385
+ if ( oDTSettings._colReorder ) {
386
+ throw "ColReorder already initialised on table #"+oDTSettings.nTable.id;
387
+ }
388
+
393
389
  // Convert from camelCase to Hungarian, just as DataTables does
394
390
  var camelToHungarian = $.fn.dataTable.camelToHungarian;
395
391
  if ( camelToHungarian ) {
@@ -440,11 +436,11 @@ var ColReorder = function( dt, opts )
440
436
 
441
437
  /**
442
438
  * Callback function for once the reorder has been done
443
- * @property dropcallback
439
+ * @property reorderCallback
444
440
  * @type function
445
441
  * @default null
446
442
  */
447
- "dropCallback": null,
443
+ "reorderCallback": null,
448
444
 
449
445
  /**
450
446
  * @namespace Information used for the mouse drag
@@ -495,7 +491,7 @@ var ColReorder = function( dt, opts )
495
491
 
496
492
 
497
493
  /* Constructor logic */
498
- this.s.dt = oDTSettings.oInstance.fnSettings();
494
+ this.s.dt = oDTSettings;
499
495
  this.s.dt._colReorder = this;
500
496
  this._fnConstruct();
501
497
 
@@ -637,7 +633,7 @@ ColReorder.prototype = {
637
633
  /* Drop callback initialisation option */
638
634
  if ( this.s.init.fnReorderCallback )
639
635
  {
640
- this.s.dropCallback = this.s.init.fnReorderCallback;
636
+ this.s.reorderCallback = this.s.init.fnReorderCallback;
641
637
  }
642
638
 
643
639
  /* Add event handlers for the drag and drop, and also mark the original column order */
@@ -736,13 +732,18 @@ ColReorder.prototype = {
736
732
  /* When scrolling we need to recalculate the column sizes to allow for the shift */
737
733
  if ( this.s.dt.oScroll.sX !== "" || this.s.dt.oScroll.sY !== "" )
738
734
  {
739
- this.s.dt.oInstance.fnAdjustColumnSizing();
735
+ this.s.dt.oInstance.fnAdjustColumnSizing( false );
740
736
  }
741
737
 
742
738
  /* Save the state */
743
739
  this.s.dt.oInstance.oApi._fnSaveState( this.s.dt );
744
740
 
745
741
  this._fnSetColumnIndexes();
742
+
743
+ if ( this.s.reorderCallback !== null )
744
+ {
745
+ this.s.reorderCallback.call( this );
746
+ }
746
747
  },
747
748
 
748
749
 
@@ -964,16 +965,16 @@ ColReorder.prototype = {
964
965
  /* When scrolling we need to recalculate the column sizes to allow for the shift */
965
966
  if ( this.s.dt.oScroll.sX !== "" || this.s.dt.oScroll.sY !== "" )
966
967
  {
967
- this.s.dt.oInstance.fnAdjustColumnSizing();
968
- }
969
-
970
- if ( this.s.dropCallback !== null )
971
- {
972
- this.s.dropCallback.call( this );
968
+ this.s.dt.oInstance.fnAdjustColumnSizing( false );
973
969
  }
974
970
 
975
971
  /* Save the state */
976
972
  this.s.dt.oInstance.oApi._fnSaveState( this.s.dt );
973
+
974
+ if ( this.s.reorderCallback !== null )
975
+ {
976
+ this.s.reorderCallback.call( this );
977
+ }
977
978
  }
978
979
  },
979
980
 
@@ -1054,8 +1055,8 @@ ColReorder.prototype = {
1054
1055
  this.dom.drag = $(origTable.cloneNode(false))
1055
1056
  .addClass( 'DTCR_clonedTable' )
1056
1057
  .append(
1057
- origThead.cloneNode(false).appendChild(
1058
- origTr.cloneNode(false).appendChild(
1058
+ $(origThead.cloneNode(false)).append(
1059
+ $(origTr.cloneNode(false)).append(
1059
1060
  cloneCell[0]
1060
1061
  )
1061
1062
  )
@@ -1286,7 +1287,7 @@ ColReorder.defaults = {
1286
1287
  * @type String
1287
1288
  * @default As code
1288
1289
  */
1289
- ColReorder.version = "1.1.2";
1290
+ ColReorder.version = "1.1.3";
1290
1291
 
1291
1292
 
1292
1293
 
@@ -1,15 +1,15 @@
1
- /*! ColVis 1.1.1
2
- * ©2010-2014 SpryMedia Ltd - datatables.net/license
1
+ /*! ColVis 1.1.2
2
+ * ©2010-2015 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
5
  /**
6
6
  * @summary ColVis
7
7
  * @description Controls for column visibility in DataTables
8
- * @version 1.1.1
8
+ * @version 1.1.2
9
9
  * @file dataTables.colReorder.js
10
10
  * @author SpryMedia Ltd (www.sprymedia.co.uk)
11
11
  * @contact www.sprymedia.co.uk/contact
12
- * @copyright Copyright 2010-2014 SpryMedia Ltd.
12
+ * @copyright Copyright 2010-2015 SpryMedia Ltd.
13
13
  *
14
14
  * This source file is free software, available under the following license:
15
15
  * MIT license - http://datatables.net/license/mit
@@ -49,8 +49,10 @@ var ColVis = function( oDTSettings, oInit )
49
49
  oInit = {};
50
50
  }
51
51
 
52
- if ( $.fn.dataTable.camelToHungarian ) {
53
- $.fn.dataTable.camelToHungarian( ColVis.defaults, oInit );
52
+ var camelToHungarian = $.fn.dataTable.camelToHungarian;
53
+ if ( camelToHungarian ) {
54
+ camelToHungarian( ColVis.defaults, ColVis.defaults, true );
55
+ camelToHungarian( ColVis.defaults, oInit );
54
56
  }
55
57
 
56
58
 
@@ -217,6 +219,7 @@ ColVis.prototype = {
217
219
  this.dom.collection.removeChild( this.dom.buttons[i] );
218
220
  }
219
221
  this.dom.buttons.splice( 0, this.dom.buttons.length );
222
+ this.dom.groupButtons.splice(0, this.dom.groupButtons.length);
220
223
 
221
224
  if ( this.dom.restore ) {
222
225
  this.dom.restore.parentNode( this.dom.restore );
@@ -286,7 +289,7 @@ ColVis.prototype = {
286
289
  /* If columns are reordered, then we need to update our exclude list and
287
290
  * rebuild the displayed list
288
291
  */
289
- $(this.s.dt.oInstance).bind( 'column-reorder', function ( e, oSettings, oReorder ) {
292
+ $(this.s.dt.oInstance).bind( 'column-reorder.dt', function ( e, oSettings, oReorder ) {
290
293
  for ( i=0, iLen=that.s.aiExclude.length ; i<iLen ; i++ ) {
291
294
  that.s.aiExclude[i] = oReorder.aiInvertMapping[ that.s.aiExclude[i] ];
292
295
  }
@@ -297,6 +300,10 @@ ColVis.prototype = {
297
300
  that.fnRebuild();
298
301
  } );
299
302
 
303
+ $(this.s.dt.oInstance).bind( 'destroy.dt', function () {
304
+ $(that.dom.wrapper).remove();
305
+ } );
306
+
300
307
  // Set the initial state
301
308
  this._fnDrawCallback();
302
309
  },
@@ -607,7 +614,10 @@ ColVis.prototype = {
607
614
  var showHide = !$('input', this).is(":checked");
608
615
  if ( e.target.nodeName.toLowerCase() !== "li" )
609
616
  {
610
- showHide = ! showHide;
617
+ if ( e.target.nodeName.toLowerCase() == "input" || that.s.fnStateChange === null )
618
+ {
619
+ showHide = ! showHide;
620
+ }
611
621
  }
612
622
 
613
623
  /* Need to consider the case where the initialiser created more than one table - change the
@@ -634,8 +644,12 @@ ColVis.prototype = {
634
644
 
635
645
  $.fn.dataTableExt.iApiIndex = oldIndex; /* Restore */
636
646
 
637
- if ( e.target.nodeName.toLowerCase() === 'input' && that.s.fnStateChange !== null )
647
+ if ( that.s.fnStateChange !== null )
638
648
  {
649
+ if ( e.target.nodeName.toLowerCase() == "span" )
650
+ {
651
+ e.preventDefault();
652
+ }
639
653
  that.s.fnStateChange.call( that, i, showHide );
640
654
  }
641
655
  } )[0];
@@ -877,7 +891,9 @@ ColVis.fnRebuild = function ( oTable )
877
891
  var nTable = null;
878
892
  if ( typeof oTable != 'undefined' )
879
893
  {
880
- nTable = oTable.fnSettings().nTable;
894
+ nTable = $.fn.dataTable.Api ?
895
+ new $.fn.dataTable.Api( oTable ).table().node() :
896
+ oTable.fnSettings().nTable;
881
897
  }
882
898
 
883
899
  for ( var i=0, iLen=ColVis.aInstances.length ; i<iLen ; i++ )
@@ -1046,7 +1062,7 @@ ColVis.prototype.CLASS = "ColVis";
1046
1062
  * @type String
1047
1063
  * @default See code
1048
1064
  */
1049
- ColVis.VERSION = "1.1.1";
1065
+ ColVis.VERSION = "1.1.2";
1050
1066
  ColVis.prototype.VERSION = ColVis.VERSION;
1051
1067
 
1052
1068