SpreadJS Documentation
Creating and Removing Selections
SpreadJS Documentation > Sample Code > Sample Code for Rows and Columns > Creating and Removing Selections

You can create or remove selections.

Using Code

This example creates and removes selections.

JavaScript
Copy Code

window.onload = function(){
       var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
       var activeSheet = spread.getActiveSheet();

activeSheet.setColumnCount(5);

     $("#button1").click(function(){
         //Select entire row 4.
        activeSheet.addSelection(3, -1, 1, -1);
     });

     $("#button2").click(function(){
         //Remove the selections in the sheet.
         activeSheet.clearSelection();
     });
                      }

See Also

Developer's Guide