diff --git a/kadmos/vistoms/templates/VISTOMS.html b/kadmos/vistoms/templates/VISTOMS.html index 5f6b4c8b19bbfc9434bd7894d05046a53cd1f470..36849b1df9b2a8581fec8aa89e6bbd544b23a9a0 100644 --- a/kadmos/vistoms/templates/VISTOMS.html +++ b/kadmos/vistoms/templates/VISTOMS.html @@ -21504,17 +21504,17 @@ } - function appendChildren(aParent, xPath_list) + function appendChildren(anElement, aParent, xPath_list) { - if (xPath_list.length > 1) + if (xPath_list.length > 0) { //If element has no children yet, initialize children array if (!aParent.children){aParent.children = [];} //remove the first element from the xPath list let newXPath_list = JSON.parse(JSON.stringify(xPath_list)); newXPath_list.shift(); - console.log(xPath_list) - console.log(newXPath_list) + <!-- console.log(xPath_list) --> + <!-- console.log(newXPath_list) --> //Create a new child element, if it does not exist yet if (!childExists(xPath_list[0], aParent.children)) { @@ -21524,11 +21524,19 @@ } aParent.children.forEach(function(aChild) { - <!-- console.log("Children will be appended for: " + aChild.name) --> - <!-- console.log(newXPath_list) --> - appendChildren(aChild, newXPath_list) + if (xPath_list[0] == aChild.name) + { + <!-- console.log("Children will be appended for: " + aChild.name) --> + <!-- console.log(newXPath_list) --> + <!-- console.log(anElement.xpath) --> + appendChildren(anElement, aChild, newXPath_list) + } }) - } + } + else + { + aParent.value = anElement.value; + } } var newTree = {}; @@ -21541,17 +21549,17 @@ if (index > -1) {xPath_split.splice(index, 1);} root.level = 0 root.name = xPath_split[0] - console.log("####################") - console.log(element.xpath) - appendChildren(root, xPath_split) + <!-- console.log("####################") --> + <!-- console.log(element.xpath) --> + let newXPath_split = JSON.parse(JSON.stringify(xPath_split)); + newXPath_split.shift(); + appendChildren(element, root, newXPath_split) + <!-- console.log("DONE!") --> + <!-- console.log("####################") --> }) } - buildTree(newTree, treeData) - - console.log(newTree) - - return - console.log("I passed the return!!!") + buildTree(newTree, treeData) + treeData = newTree //###################################################################### //aigner:New implementation end