webui: detach facet nodes

Detach/attach facet nodes when switching facets instead of
hiding/showing.

Keeps dom-tree more simple.

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-07-22 14:15:30 +02:00
parent fb975bba20
commit 9aed114d82
2 changed files with 10 additions and 0 deletions

View File

@ -672,6 +672,8 @@ exp.facet = IPA.facet = function(spec, no_init) {
if (!that.dom_node) {
that.create();
} else if (!that.dom_node.parentElement) {
construct.place(that.dom_node[0], that.container_node);
}
var state = that.state.clone();
@ -728,6 +730,9 @@ exp.facet = IPA.facet = function(spec, no_init) {
*/
that.hide = function() {
that.is_shown = false;
if (that.dom_node[0].parentElement) {
that.container_node.removeChild(that.dom_node[0]);
}
that.dom_node.removeClass('active-facet');
};

View File

@ -285,6 +285,8 @@ define(['dojo/_base/declare',
if (!this.dom_node) {
this.create();
this.render_children();
} else if (!this.dom_node.parentElement) {
construct.place(this.dom_node, this.container_node);
}
dom_class.add(this.dom_node, 'active-facet');
@ -295,6 +297,9 @@ define(['dojo/_base/declare',
* Un-mark itself as active facet
*/
hide: function() {
if (this.dom_node.parentElement) {
this.container_node.removeChild(this.dom_node);
}
dom_class.remove(this.dom_node, 'active-facet');
this.emit('hide', { source: this });
},