Tree - v2.1 - Destructor

RE: dhtmlx.com/docs/products/kb/ … mal&q=8250



It looks like the fix from v1.6 for the destructor function didn’t make it to v2.1.



v1.6 build 80512:

dhtmlXTreeObject.prototype.destructor=function(){for (var a in this._idpull){var z=this._idpull[a];if (!z)continue;z.parentObject=null;z.treeNod=null;z.childNodes=null;z.span=null; → if(z.tr) ← z.tr.nodem=null;z.tr=null; → if(z.htmlNode) ← z.htmlNode.objBelong=null;z.htmlNode=null;…



v2.1 build 90226:

dhtmlXTreeObject.prototype.destructor=function(){for (var a in this._idpull){var z=this._idpull[a];if (!z)continue;z.parentObject=null;z.treeNod=null;z.childNodes=null;z.span=null;z.tr.nodem=null;z.tr=null;z.htmlNode.objBelong=null;z.htmlNode=null;…



Thanks,

- Dave


Hello,


Could you please explain what problem you have faced with destructor() method in the latest tree version.


When tree.destructor() is called with the v2.1 build 90226 code, a JS error is generated. The error is along the lines of “tr is not an object.” This is because the code attempts to destroy z.tr.nodem without first ensuring that z.tr actually exists (it may not always.)



The same type of error occurs for “z.htmlNode.objBelong” as well (z.htmlNode doesn’t always exist.)



Thanks,



- Dave


Locally, the issue isn’t confirmed. Please, see attached sample


Could you please provide the sample to re-create the described issue.


1242635453.zip (39 KB)


That version of dhtmlxtree.js works. The v2.1 build 90226 file that we were sent via email is very different than the one provided in the sample.


Hello,


this sample contains libraries from standard edition. Please, contact us at support@dhtmlx.com, provide your ref.number and we’ll send you PRO version of this sample