RdsService.moveItems

Syntax

moveItems(dict: PP.Rds.Dictionary, moveElKeys: Array, relElKeys: Array, rels: PP.Mb.TreeRelation, callback: function|PP.Delegate);

Parameters

dict. MDM dictionary.

moveElKeys. Array of the keys of the elements to be moved.

relElKeys. Array that contains keys of the elements, relative to which the elements will be moved.

rels. Position relative to the elements with the relElKeys key after movement.

Description

The moveItems method moves dictionary elements respective to 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 service for working with the dictionary
var service = source.getPPService();
// Obtain child elements of the dictionary
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
if (!source.isPlain()) {
    service.moveItems(source, keys[1], keys[0], PP.Mb.TreeRelation.FirstChild);
} else {
    console.log("Dictionary elements do not have hierarcht.");
};
// Remove third element
service.removeItems(source, keys[2]);
// Reftesh dictionary element tree
dictionaryBox.getDataArea().getActiveDictTree().refreshAll(true);

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:

RdsService