addChildElem(key, elem)
key. Parent element key. Set an empty string if no parent element is available.
elem. Element to be added to the dimension. El structure.
The addChildElem method adds a dictionary child.
To execute the example, the HTML page must contain the DimTree component named dimTree (see. Example of Creating the DimTree Component). Add a new dictionary element and handler of dictionary element change event:
dim.ElsChanged.add(function(sender, args) {
console.log("Dimension element is changed");
});
dim.addChildElem("",
{
"k": "1",
"n": "New element",
"h": "1",
"o": "0",
"a": {
"it": ["New element", "1", "1", "0", "A000123"]
}
});
dimTree.refresh();
After executing the example a new element is added to the dictionary and shown in the tree:
The console displays a message about changed dimension element:
Dimension element is changed
Use the DimSource.clearDimItems method to remove the new element from the list:
dim.clearDimItems(); dimTree.refreshAll();
See also: