fix: removing orphaned connectors
This commit is contained in:
parent
2fcd05aa82
commit
ad06603392
@ -176,8 +176,8 @@ erpnext.HierarchyChart = class {
|
|||||||
|
|
||||||
collapse_node() {
|
collapse_node() {
|
||||||
if (this.selected_node.expandable) {
|
if (this.selected_node.expandable) {
|
||||||
this.selected_node.$children.hide('fast');
|
this.selected_node.$children.hide();
|
||||||
$(`path[data-parent="${this.selected_node.id}"]`).hide('fast');
|
$(`path[data-parent="${this.selected_node.id}"]`).hide();
|
||||||
this.selected_node.expanded = false;
|
this.selected_node.expanded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,8 +237,8 @@ erpnext.HierarchyChart = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node.$children.show('fast');
|
node.$children.show();
|
||||||
$(`path[data-parent="${node.id}"]`).show('fast');
|
$(`path[data-parent="${node.id}"]`).show();
|
||||||
node.expanded = true;
|
node.expanded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,9 +262,7 @@ erpnext.HierarchyChart = class {
|
|||||||
let parent_node = document.querySelector(`#${parent_id}`);
|
let parent_node = document.querySelector(`#${parent_id}`);
|
||||||
let child_node = document.querySelector(`#${child_id}`);
|
let child_node = document.querySelector(`#${child_id}`);
|
||||||
|
|
||||||
// variable for the namespace
|
let path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
||||||
const svgns = 'http://www.w3.org/2000/svg';
|
|
||||||
let path = document.createElementNS(svgns, 'path');
|
|
||||||
|
|
||||||
// we need to connect right side of the parent to the left side of the child node
|
// we need to connect right side of the parent to the left side of the child node
|
||||||
let pos_parent_right = {
|
let pos_parent_right = {
|
||||||
@ -438,7 +436,7 @@ erpnext.HierarchyChart = class {
|
|||||||
let parent = $(path).data('parent');
|
let parent = $(path).data('parent');
|
||||||
let child = $(path).data('child');
|
let child = $(path).data('child');
|
||||||
|
|
||||||
if ($(parent).length || $(child).length)
|
if ($(`#${parent}`).length && $(`#${child}`).length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$(path).remove();
|
$(path).remove();
|
||||||
|
@ -289,9 +289,7 @@ erpnext.HierarchyChartMobile = class {
|
|||||||
let parent_node = document.querySelector(`#${parent_id}`);
|
let parent_node = document.querySelector(`#${parent_id}`);
|
||||||
let child_node = document.querySelector(`#${child_id}`);
|
let child_node = document.querySelector(`#${child_id}`);
|
||||||
|
|
||||||
// variable for the namespace
|
let path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
||||||
const svgns = 'http://www.w3.org/2000/svg';
|
|
||||||
let path = document.createElementNS(svgns, 'path');
|
|
||||||
|
|
||||||
let connector = undefined;
|
let connector = undefined;
|
||||||
|
|
||||||
@ -514,7 +512,7 @@ erpnext.HierarchyChartMobile = class {
|
|||||||
let parent = $(path).data('parent');
|
let parent = $(path).data('parent');
|
||||||
let child = $(path).data('child');
|
let child = $(path).data('child');
|
||||||
|
|
||||||
if ($(parent).length || $(child).length)
|
if ($(`#${parent}`).length && $(`#${child}`).length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$(path).remove();
|
$(path).remove();
|
||||||
|
Loading…
Reference in New Issue
Block a user