SpreadJS Documentation
Deleting Columns and Rows

You can delete columns and rows.

Using Code

This example deletes columns and rows.

JavaScript
Copy Code
$(document).ready(function () {
    var spread = new GcSpread.Sheets.Spread($("#ss").get(0),{sheetCount:3});
    var sheet = spread.getActiveSheet();

    //Set number of rows to 3.
    sheet.setRowCount(3, GcSpread.Sheets.SheetArea.viewport);
    sheet.setValue(0, 0, "The 1st row", GcSpread.Sheets.SheetArea.viewport);
    sheet.setValue(1, 0, "The 2st row", GcSpread.Sheets.SheetArea.viewport);
    sheet.setValue(2, 0, "The 3st row", GcSpread.Sheets.SheetArea.viewport);
    sheet.setColumnWidth(0, 90.0, GcSpread.Sheets.SheetArea.viewport);

    $("#button1").click(function(){
        //Delete Row 2.
        $("#ss").data("spread").getActiveSheet().deleteRows(1, 1);
    });

    $("#button2").click(function(){
        //Delete Column 2.
        $("#ss").data("spread").getActiveSheet().deleteColumns(1, 1);
    });
});

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.