MetaSource.getElems

Syntax

getElems(filter: PP.Mb.ElsFilter);

Parameters

filter. Filter, to which child elements satisfy. If this filter was used the last time, loaded model elements are removed.

Description

The getElems method returns loaded tree model elements.

Example

To execute the example, the HTML page must contain the MetaTree component named metaTree (see MetaTree Constructor). Check if all elements are loaded and check if there are elements in model:

// Get metadata tree model
var metaSource = metaTree.getSource();
// Check if all elements are loaded 
if (metaSource.getIsDataLoading()) {
    console.log("Elements are loading");
} else {
    console.log("All elements are loaded");
}
//Check if there are element is model
if (metaSource.getIsEmpty()) {
    console.log("Model does not contain elements");
} else {
    console.log("Model contains elements");
}

As a result the console displays check result:

All elements are loaded

Model contains elements

 

Get names of loaded model elements:

// Get loaded model elements
var elems = metaSource.getElems(metaSource.getDefaultFilter());
console.log("Loaded model elements:");
for (var i in elems) {
    console.log(elems[i].n);
}

As a result the console displays names of loaded model elements:

Loaded model elements:

express1

Providers

See also:

MetaSource