DictionaryTree.addItem

Syntax

addItem(pKey: Number, dItem: PP.Rds.DItem)

Parameters

pKey. Key of added element's parent. If the parameter is not defined, key of the last selected element is used. If no elements are selected, the new element is added to the tree root.

dItem. Element to be added. If the parameter is not specified, the ElementCard component is shown to create a new element.

Description

The addItem method adds a new element to the tree.

Example

To execute this example, the page must contain the DictionaryBox component named dictionaryBox (see Example of creating the DictionaryBox component ). Get tree of dictionary elements and process the TreeEdited event. Show the ElementCard component to create a new element:

// Get dictionary data area
var area = dictionaryBox.getDataArea();
// Get tree of dictionary elements
var tree = area.getActiveDictTree();
// Process the TreeEdited event
tree.TreeEdited.add(function (sender, eventArgs) {
    console.log("TreeEdited event initialized");
});
// Add a new element
tree.addItem();

Add manually a new element named Minute to the tree.

As the result, a new element is added in the tree:

The browser console shows a message that the processed event was invoked:

TreeEdited event initialized

See also:

DictionaryTree