简体   繁体   English

DOJO-在将父级从DOM中删除之前销毁子级

[英]DOJO - Destroy children before parent is removed from DOM

This is my scenario, 这是我的情况

I am having dijit TabContainer in my page and inside the TabContainer is a CKEDITOR. 我的页面中有Dijit TabContainer,并且在TabContainer内部是一个CKEDITOR。

The problem is when I close the dijit tab, the parent element is first removed from the DOM and then recurrsively all the children are destroyed. 问题是当我关闭dijit选项卡时,首先从DOM中删除了父元素,然后递归地销毁了所有子元素。 But in the case of CKEDITOR which is a child inside the tab, it requires the editor to be present in the DOM for it to destroy. 但是,如果CKEDITOR是选项卡中的子项,则它要求该编辑器出现在DOM中才能销毁。 (CKEDITOR.instances[0].destroy()) (CKEDITOR.instances [0] .destroy())

Is there a way for me to tell the tabcontainer not to remove itself from the DOM before destroying the child widgets? 有没有办法让我告诉Tab容器在销毁子小部件之前不要从DOM中删除自身?

I'd try changing the tab-closing code so that it calls widget.destroyRecursive(true) , and clean up the DOM manually afterwards. 我会尝试更改制表符关闭代码,以便它调用widget.destroyRecursive(true) ,然后手动清理DOM。 From the _WidgetBase 1.9 source, by passing true you are influencing: _WidgetBase 1.9来源,通过传递true您正在影响:

// preserveDom:
//      If true, this method will leave the original DOM structure
//      alone of descendant Widgets. Note: This will NOT work with
//      dijit._TemplatedMixin widgets.

I don't quite understand what's going on with the _TemplatedMixin warning, however. 但是,我不太了解_TemplatedMixin警告的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM