From 0dec62e4610465b407c384a444c4441463ee57e0 Mon Sep 17 00:00:00 2001 From: Hasan Iskandar Date: Thu, 15 Jun 2023 22:27:13 +0700 Subject: [PATCH] Handle DataTable.destroy() --- ColReorderWithResize.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ColReorderWithResize.js b/ColReorderWithResize.js index e59331c..097fc11 100644 --- a/ColReorderWithResize.js +++ b/ColReorderWithResize.js @@ -818,6 +818,8 @@ $.extend( ColReorder.prototype, { // Destroy clean up $(table).on( 'destroy.dt.colReorder', function () { $(table).off( 'destroy.dt.colReorder draw.dt.colReorder' ); + if (that.s === null) return; + $(that.s.dt.nTHead).find( '*' ).off( '.ColReorder' ); $.each( that.s.dt.aoColumns, function (i, column) { @@ -899,6 +901,8 @@ $.extend( ColReorder.prototype, { */ "_fnStateSave": function ( oState ) { + if (this.s === null) return; + var i, iLen, aCopy, iOrigColumn; var oSettings = this.s.dt; var columns = oSettings.aoColumns;