mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-18 11:52:11 +01:00
Fixed: fnDestroy didn't restore columns which had been hidden by DataTables, resulting in these columns being completely lost - 2569
This commit is contained in:
parent
505bfce7c2
commit
29d7a0a182
@ -18,6 +18,7 @@
|
||||
{ "bSearchable": false, "bVisible": false, "aTargets": [ 2 ] },
|
||||
{ "bVisible": false, "aTargets": [ 3 ] }
|
||||
] } );
|
||||
$('#example').dataTable().fnDestroy();
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
<h1>Live example</h1>
|
||||
<div id="demo">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example" style="width:80%">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Rendering engine</th>
|
||||
|
9
media/js/jquery.dataTables.js
vendored
9
media/js/jquery.dataTables.js
vendored
@ -2040,6 +2040,15 @@
|
||||
var nBody = oSettings.nTBody;
|
||||
var i, iLen;
|
||||
|
||||
/* Restore hidden columns */
|
||||
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( oSettings.aoColumns[i].bVisible === false )
|
||||
{
|
||||
this.fnSetColumnVis( i, true );
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove the DataTables generated nodes, events and classes */
|
||||
oSettings.nTable.parentNode.removeChild( oSettings.nTable );
|
||||
$(oSettings.nTableWrapper).remove();
|
||||
|
20
media/unit_testing/tests_onhold/1_dom/2569.js
Executable file
20
media/unit_testing/tests_onhold/1_dom/2569.js
Executable file
@ -0,0 +1,20 @@
|
||||
// DATA_TEMPLATE: dom_data
|
||||
oTest.fnStart( "Destroy with hidden columns" );
|
||||
|
||||
$(document).ready( function () {
|
||||
$('#example').dataTable( {
|
||||
"aoColumnDefs": [
|
||||
{ "bSearchable": false, "bVisible": false, "aTargets": [ 2 ] },
|
||||
{ "bVisible": false, "aTargets": [ 3 ] }
|
||||
]
|
||||
} );
|
||||
$('#example').dataTable().fnDestroy();
|
||||
|
||||
oTest.fnTest(
|
||||
"Check that the number of columns in table is correct",
|
||||
null,
|
||||
function () { return $('#example tbody tr:eq(0) td').length == 5; }
|
||||
);
|
||||
|
||||
oTest.fnComplete();
|
||||
} );
|
Loading…
x
Reference in New Issue
Block a user