Dictionary.clearElemsData

Syntax

clearElemsData();

Description

The clearElemsData method clears MDM dictionary elements.

Example

To execute this example, the page must contain the DictionaryBox component named dictionaryBox (see Example of creating the DictionaryBox component ). Clear all elements of MDM dictionary:

// Get MDM dictionary
var source = dictionaryBox.getSource()[0];
if (source.getChildEls()) {
    console.log("Number of first level elements before clearing: %s", source.getChildEls().length);
};
// Clear dictionary elements
source.clearElemsData();
if (source.getChildEls()) {
    console.log("Number of first level elements after clearing: %s", source.getChildEls().length);
} else {
    console.log("After clearing the data source contains no elements");
};

After executing the example all MDM dictionary elements are cleared, and appropriate notices are shown in the browser console:

Number of first level elements before clearing: 3

After clearing the data source contains no elements

See also:

Dictionary