SpreadJS 13
SpreadJS Documentation / Sample Code / Sample Code for Rows and Columns / Deleting Columns and Rows
In This Topic
    Deleting Columns and Rows
    In This Topic

    You can delete columns and rows.

    Using Code

    This example deletes columns and rows.

    JavaScript
    Copy Code
     $(document).ready(function () 
      {
        var spread = 
        new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
        var sheet = spread.getActiveSheet();
        
        // Set number of rows to 3.
        sheet.setRowCount(3, GC.Spread.Sheets.SheetArea.viewport);
        sheet.setValue(0, 0, "The 1st row", GC.Spread.Sheets.SheetArea.viewport);
        sheet.setValue(1, 0, "The 2st row", GC.Spread.Sheets.SheetArea.viewport);
        sheet.setValue(2, 0, "The 3st row", GC.Spread.Sheets.SheetArea.viewport);
        sheet.setColumnWidth(0, 90.0, GC.Spread.Sheets.SheetArea.viewport);
        $("#button1").click(function()
         {
            // Delete Row 2.
            spread.getActiveSheet().deleteRows(1, 1);
         });
        
        $("#button2").click(function()
         {
           // Delete Column 2.
           spread.getActiveSheet().deleteColumns(1, 1);
         });
    });