mirror of
https://github.com/DataTables/DataTables.git
synced 2025-02-19 17:54:14 +01:00
Fix: IE8 events error
* In IE8 if the DataTables width calculation functions were being triggered DataTables would clone the table node and then do a jQuery $().remove() on the cloned node. This was bad in IE8 as it meant that on the remove the events that were attached tot he original table were removed as well as the ones on the clone table. IE8 must retain some kind of link between the original and clone nodes. Using jQuery's clone() method resolves this. * See thread 21040 for more information
This commit is contained in:
parent
de1d6541ef
commit
00a99a0037
@ -1 +1 @@
|
||||
77ee28e07cf8b949f2650b800e0fca791d4b767f
|
||||
b7feaa2d3aa296b3b0224af59f2523049eac63bb
|
||||
|
@ -20,7 +20,11 @@
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable();
|
||||
$('#example').dataTable( {
|
||||
columnDefs: [
|
||||
{ targets: 0, width: '50px' }
|
||||
]
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
@ -535,7 +539,11 @@ $(document).ready(function() {
|
||||
<div class="js">
|
||||
<p>The Javascript shown below is used to initialise the table shown in this
|
||||
example:</p><code class="multiline brush: js;">$(document).ready(function() {
|
||||
$('#example').dataTable();
|
||||
$('#example').dataTable( {
|
||||
columnDefs: [
|
||||
{ targets: 0, width: '50px' }
|
||||
]
|
||||
} );
|
||||
} );</code>
|
||||
|
||||
<p>In addition to the above code, the following Javascript library files are loaded for use in this
|
||||
|
19
media/js/jquery.dataTables.js
vendored
19
media/js/jquery.dataTables.js
vendored
@ -2003,11 +2003,14 @@
|
||||
settings.aiDisplay = settings.aiDisplayMaster.slice();
|
||||
}
|
||||
|
||||
settings._drawHold = holdPosition;
|
||||
if ( holdPosition !== true ) {
|
||||
settings._iDisplayStart = 0;
|
||||
}
|
||||
|
||||
_fnDraw( settings );
|
||||
|
||||
settings._drawHold = false;
|
||||
}
|
||||
|
||||
|
||||
@ -3847,8 +3850,9 @@
|
||||
/* Adjust the position of the header in case we loose the y-scrollbar */
|
||||
divBody.scroll();
|
||||
|
||||
/* If sorting or filtering has occurred, jump the scrolling back to the top */
|
||||
if ( settings.bSorted || settings.bFiltered ) {
|
||||
// If sorting or filtering has occurred, jump the scrolling back to the top
|
||||
// only if we aren't holding the position
|
||||
if ( (settings.bSorted || settings.bFiltered) && ! settings._drawHold ) {
|
||||
divBodyEl.scrollTop = 0;
|
||||
}
|
||||
}
|
||||
@ -3948,7 +3952,8 @@
|
||||
// Otherwise construct a single row table with the widest node in the
|
||||
// data, assign any user defined widths, then insert it into the DOM and
|
||||
// allow the browser to do all the hard work of calculating table widths
|
||||
var tmpTable = $( table.cloneNode( false ) )
|
||||
var tmpTable = $(table).clone() // don't use cloneNode - IE8 will remove events on the main table
|
||||
.empty()
|
||||
.css( 'visibility', 'hidden' )
|
||||
.removeAttr( 'id' )
|
||||
.append( $(oSettings.nTHead).clone( false ) )
|
||||
@ -4991,7 +4996,7 @@
|
||||
* trigger
|
||||
* @memberof DataTable#oApi
|
||||
*/
|
||||
function _fnCallbackFire( settings, callbackArr, event, args )
|
||||
function _fnCallbackFire( settings, callbackArr, e, args )
|
||||
{
|
||||
var ret = [];
|
||||
|
||||
@ -5001,8 +5006,9 @@
|
||||
} );
|
||||
}
|
||||
|
||||
if ( event !== null ) {
|
||||
$(settings.nTable).trigger( event+'.dt', args );
|
||||
if ( e !== null ) {
|
||||
console.log( e+'.dt' );
|
||||
$(settings.nTable).trigger( e+'.dt', args );
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -13971,6 +13977,7 @@
|
||||
// on destroy, while the `dt` namespaced event is the one we are
|
||||
// listening for
|
||||
$(settings.nTable).on( 'order.dt.DT', function ( e, settings, sorting, columns ) {
|
||||
console.log( 'doing an order' );
|
||||
var colIdx = column.idx;
|
||||
|
||||
cell
|
||||
|
Loading…
x
Reference in New Issue
Block a user