Dictionary.moveElem

Syntax

moveElem(key: Number, targetKey: Number, relation: PP.Mb.TreeRelation);

Parameters

key. Key of the element to move.

targetKey. Key of the elements, relative to which the first element is moved.

rels. Position relative to the targetKey node after moving.

Description

The moveItems method moves dictionary element relative to a specified element.

Example

To execute this example, the page must contain the DictionaryBox component named dictionaryBox (see Example of creating the DictionaryBox component ). Get all children of MDM dictionary. Make the second element child of the first element, next remove the third element:

// Obtain MDM dictionary
var source = dictionaryBox.getSource()[0];
// Obtain dictionary child elements
var childEls = source.getChildEls();
var keys = [];
for (var i = 0; i < childEls.length; i++) {
    keys.push(childEls[i].getKey());
};
// Make second element child relative to the first element
source.moveElem(keys[1], keys[0], PP.Mb.TreeRelation.FirstChild);
// Remove third element of the dictionary
source.removeElements(keys[2]);
// Refresh dictionary element tree
dictionaryBox.getDataArea().getActiveDictTree().refreshAll();

After executing the example the second child of MDM dictionary becomes a descendant of the first element, and the third element is removed:

See also:

Dictionary