closeHie (hie);
hie. Sets hierarchy.
The closeHie method closes a selected series hierarchy.
If a hierarchy is closed, an exception is thrown on calling the methods that use this hierarchy.
To execute the example, the page must contain the WorkbookBox component named workbookBox (see Example of Creating the WorkbookBox Component), and also add the following code in the handler, that processes document opening event:
var closeHieButt = new PP.Ui.Button({ ParentNode: document.body, //DOM parent node Content: "Close hierarchy", //text Click: PP.Delegate(onClickCloseHie) }); function onClickCloseHie() { //Get the current sheet key var sheetKey = wbk.getActiveSheet().getKey(); //Get workbook sheets var sheets = wbk.getDocumentMetadata().sheets.its.it; if(sheets.length <= 1) return; //Enable removing of workbook sheets workbookBox.getDataView()._TabControl.setEnableDelete(sheets.length > 1); var newActKey = null; //key of the sheet tat must be made active after removing //If an active sheet is removed, determine, which sheet will be active after removing if (sheets.length > 1) { newActKey = sheets[1].k; } //Close hierarchy of removed sheet series tsService.closeHie(wbk.getHier()); //Remove workbook sheet tsService.removeSheet(wbk, sheetKey, PP.Delegate(onSheetRemoved)); function onSheetRemoved(sender, args) { workbookBox.getDataView().setActiveSheet(newActKey); } workbookBox.getDataView()._TabControl.removeItem(0); }
After executing the example a button named Close Hierarchy is placed on the HTML page. Add a new sheet to the workbook and return to the first sheet. On clicking the Close Hierarchy button the active sheet will be deleted.
See also: