TabSheetSelection.getSelectedRanges

Syntax

getSelectedRanges();

Description

The getSelectedRanges method gets array of cell ranges selected in the table.

Comments

This method returns an array of PP.Ui.TabSheetRange objects.

Example

To execute the example, the HTML page must contain the TabSheet component named tabSheet (see Example of Creating the TabSheet Component). Select the cell A0 and the range B1-C2 in the table, then find the number of cells in each selected range:

// Get selection object
var objSelection = tabSheet.getSelection();
// Select two cell ranges
objSelection.select(tabSheet.getRange(1, 2, 2, 1), False, tabSheet.coord(1, 2));
objSelection.select(tabSheet.getRange(0, 0, 0, 0), True, tabSheet.coord(0, 0));
// Get selected table areas
var selectedRanges = objSelection.getSelectedRanges();
for (var i in selectedRanges) {
    var range = selectedRanges[i];
    // Get the number of cells in this area
    var count = range.getCoordsCount();
    console.log("Number of cells in the selected area: " + count)    
};

After executing the example both the cell A0 and the range B1-C2 are selected in the table:

The browser console shows the number of cells in all selected table ranges:

Number of cells in the selected range: 4

Number of cells in the selected range: 1

Seebsp;also:

TabSheetSelection