getSelectedAreas();
The getSelectedAreas method gets array of selected table areas.
The method returns the array of JSON objects with the following fields: Nodes - array of HTML document nodes, Range - range of cells in selected table area, Type - type of selected area (this value equals to an element of the PP.Ui.TabSheetSelection.AreaType enumeration).
To execute the example, the HTML page must contain the TabSheet component named tabSheet (see Example of Creating the TabSheet Component). Select the A0 cell and the range B1-C2 in the table, then remove selection:
// Get selection object var objSelection = tabSheet.getSelection(); // Select two cell ranges objSelection.select(tabSheet.getRange(0, 0, 0, 0), False, tabSheet.coord(0, 0)); objSelection.select(tabSheet.getRange(1, 2, 2, 1), True, tabSheet.coord(1, 2)); var isRemoveAreas = confirm("Remove all selected areas?"); if (isRemoveAreas) { // Get selected table areas var selectedAreas = objSelection.getSelectedAreas(); for (var i in selectedAreas) { var area = selectedAreas[i]; // Remove selected area objSelection.removeArea(area) } };
After executing the example both the cell A0 and the range B1-C2 are selected in the table:
A confirmation dialog box opens before removing selected table areas. After clicking the OK button all the selected areas are removed:
See also: