SpreadJS Documentation
Working with Selections

You can select cells, rows, columns, or multiple ranges in the widget.

Click and drag with the left mouse button to select a block of cells, columns, or rows. You can use the mouse click and Ctrl key to select multiple ranges of cells. Navigation keys are listed in Using Keyboard Navigation.

You can specify the type of selection unit (cell, column, or row) with the selectionUnit method. You can specify the range of the selection (single, range, or multiple range) with the selectionPolicy method.

You can set the selection color and border with the selectionBackColor and selectionBorderColor methods. You can use standard colors and theme colors.

Using Code

This example selects a range of cells.

JavaScript
Copy Code
activeSheet.addSelection(4, 0, 2, 2);
//activeSheet.clearSelection();
var sels = activeSheet.getSelections();
alert(sels.length);

Using Code

This example allows single row or block row selection.

JavaScript
Copy Code
activeSheet.selectionUnit(GcSpread.Sheets.SelectionUnit.Row);
activeSheet.selectionPolicy(GcSpread.Sheets.SelectionPolicy.Range);

Using Code

This example sets the color for the selected area and border.

JavaScript
Copy Code
activeSheet.selectionBackColor("Accent 6");
activeSheet.selectionBorderColor("Accent 1")
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.