From ecd2c966b93877645cb95747e5c76158674f3a37 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Wed, 20 Nov 2019 10:17:56 +0000 Subject: [PATCH] Fix: JS error when setting data for an unrendered row - DD-1209 --- .datatables-commit-sync | 2 +- examples/server_side/scripts/ssp.class.php | 2 +- media/js/jquery.dataTables.js | 2 +- media/js/jquery.dataTables.min.js | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.datatables-commit-sync b/.datatables-commit-sync index 056843f0..9ac11bfd 100644 --- a/.datatables-commit-sync +++ b/.datatables-commit-sync @@ -1 +1 @@ -6776ef92435225391569648f1c84eb456f2edd9d +fe2ab543d56011d13493ac329d38de285647d927 diff --git a/examples/server_side/scripts/ssp.class.php b/examples/server_side/scripts/ssp.class.php index 59a5822f..e7f762ed 100644 --- a/examples/server_side/scripts/ssp.class.php +++ b/examples/server_side/scripts/ssp.class.php @@ -16,7 +16,7 @@ */ -// Please Remove below 4 lines as this is use in Datatatables test environment for your local or live environment please remove it or else it will not work +// REMOVE THIS BLOCK - used for DataTables test environment only! $file = $_SERVER['DOCUMENT_ROOT'].'/datatables/pdo.php'; if ( is_file( $file ) ) { include( $file ); diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 7f2cb5f1..d9d54c7f 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -8156,7 +8156,7 @@ row._aData = data; // If the DOM has an id, and the data source is an array - if ( $.isArray( data ) && row.nTr.id ) { + if ( $.isArray( data ) && row.nTr && row.nTr.id ) { _fnSetObjectDataFn( ctx[0].rowId )( data, row.nTr.id ); } diff --git a/media/js/jquery.dataTables.min.js b/media/js/jquery.dataTables.min.js index d297f256..1393dd1b 100644 --- a/media/js/jquery.dataTables.min.js +++ b/media/js/jquery.dataTables.min.js @@ -127,10 +127,10 @@ if("function"===typeof b)return f.map(d,function(a){var c=g[a];return b(a,c._aDa a,c)};t("rows()",function(a,b){a===p?a="":f.isPlainObject(a)&&(b=a,a="");b=fb(b);var c=this.iterator("table",function(c){return gc(c,a,b)},1);c.selector.rows=a;c.selector.opts=b;return c});t("rows().nodes()",function(){return this.iterator("row",function(a,b){return a.aoData[b].nTr||p},1)});t("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return la(a.aoData,b,"_aData")},1)});x("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){b=b.aoData[c]; return"search"===a?b._aFilterData:b._aSortData},1)});x("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",function(b,c){ea(b,c,a)})});x("rows().indexes()","row().index()",function(){return this.iterator("row",function(a,b){return b},1)});x("rows().ids()","row().id()",function(a){for(var b=[],c=this.context,d=0,e=c.length;d").addClass(c),f("td",d).addClass(c).html(b)[0].colSpan=W(a),e.push(d[0]))};h(c,d);b._details&&b._details.detach();b._details=f(e);b._detailsShow&&b._details.insertAfter(b.nTr)},hb=function(a,b){var c=a.context;c.length&&(a=c[0].aoData[b!==p?b:a[0]])&&a._details&&(a._details.remove(),a._detailsShow=p,a._details=p)},Yb=function(a,b){var c=a.context;c.length&&a.length&&(a=c[0].aoData[a[0]],a._details&&((a._detailsShow=b)?a._details.insertAfter(a.nTr): -a._details.detach(),ic(c[0])))},ic=function(a){var b=new v(a),c=a.aoData;b.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0").addClass(c),f("td",d).addClass(c).html(b)[0].colSpan=W(a),e.push(d[0]))};h(c,d);b._details&&b._details.detach();b._details=f(e);b._detailsShow&&b._details.insertAfter(b.nTr)},hb=function(a,b){var c=a.context;c.length&&(a=c[0].aoData[b!==p?b:a[0]])&&a._details&&(a._details.remove(),a._detailsShow=p,a._details=p)},Yb=function(a,b){var c=a.context;c.length&&a.length&&(a=c[0].aoData[a[0]],a._details&&((a._detailsShow= +b)?a._details.insertAfter(a.nTr):a._details.detach(),ic(c[0])))},ic=function(a){var b=new v(a),c=a.aoData;b.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0g){var m=f.map(d,function(a,b){return a.bVisible?b:null});return[m[m.length+g]]}return[ba(a,g)];case "name":return f.map(e,function(a,b){return a===n[1]?b:null});default:return[]}if(b.nodeName&&b._DT_CellIndex)return[b._DT_CellIndex.column];g=f(h).filter(b).map(function(){return f.inArray(this,