getElement (key);
key. Dimension element key.
The getElement method returns selection element by its key.
To execute the example, the HTML page must contain the ExpressBox component named expressBox (see Example of Creating the ExpressBox Component). The express report must include dimension with the index 4, that contains an element with the key 1. The dimension element with the key 1 must have children (the node with the key 1 must be open in dimensions tree in the Selection tab of the side panel). Set a collection of dimension elements selections for the express report, get selection with the index 4, set selection for the dimension element with the key 1 and for its children, next remove the element with the key 1 from selection:
var eaxAnalyzer = expressBox.getSource(); // Determine a set of dimension element selections for express report eaxAnalyzer.setDimSelectionFilterSet(new PP.Mb.DimSelectionSet({ OdId: eaxAnalyzer.getDimFilterOdId(), // Moniker CorrelatedDims: eaxAnalyzer.getDims() // Array of dimensions }));//Get a set of report's dimension element selections dimSet = eaxAnalyzer.getDimSelectionFilterSet(); //Get selection with the 4 index dimSel = dimSet.getItems()[4]; //Add an element with the 1 key to the selection dimSel.selectElement(1); //Add child elements of the element with the 1 key to the selection dimSel.selectChildren(1); console.log("Number of child elements: " + dimSel.getElement(1)._PPChild.length); console.log("Number of selection elements before deleting: " + dimSel.getElements().length); // Delete the element with the key from the selection dimSel.deselectElement(1); console.log("Number of selection elements after deleting: " + dimSel.getElements().length);
After executing the example the element with the key 1 and its children are added to selection of express report dimension with the index 4, after that the element with the key 1 is removed from selection. The browser console shows number of children for the element with the key 1, number of selected elements before and after the element with the key 1 is removed from selection:
Number of children: 5
Number of selection elements before deletion: 6
Number of selection elements after deletion: 5
See also: