1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-19 17:54:14 +01:00

Fix: fnDestory would put the table back into the DOM in the wrong place if the table wasn't the the only (or last) element in the parent (i.e. it was just doing an append) - 4751

This commit is contained in:
Allan Jardine 2011-04-23 08:58:58 +01:00
parent 22f0ebb26f
commit 707953a285
2 changed files with 14 additions and 4 deletions

View File

@ -18,6 +18,7 @@
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
oTable.fnDestroy();
} );
</script>
</head>

View File

@ -2210,7 +2210,15 @@
}
/* Add the TR elements back into the table in their original order */
nOrig.appendChild( oSettings.nTable );
if ( oSettings.nTableReinsertBefore )
{
nOrig.insertBefore( oSettings.nTable, oSettings.nTableReinsertBefore );
}
else
{
nOrig.appendChild( oSettings.nTable );
}
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
{
if ( oSettings.aoData[i].nTr !== null )
@ -3511,8 +3519,7 @@
oSettings.nTable.parentNode.insertBefore( nHolding, oSettings.nTable );
/*
* All DataTables are wrapped in a div - this is not currently optional - backwards
* compatability. It can be removed if you don't want it.
* All DataTables are wrapped in a div
*/
oSettings.nTableWrapper = document.createElement( 'div' );
oSettings.nTableWrapper.className = oSettings.oClasses.sWrapper;
@ -3520,7 +3527,9 @@
{
oSettings.nTableWrapper.setAttribute( 'id', oSettings.sTableId+'_wrapper' );
}
oSettings.nTableReinsertBefore = oSettings.nTable.nextSibling;
/* Track where we want to insert the option */
var nInsertNode = oSettings.nTableWrapper;