SpreadJS 13
GC.Spread.Sheets Namespace / Commands type / clearValues Field
In This Topic
    clearValues Field
    In This Topic
    Represents the command used to clear cell values on a worksheet.
    Syntax
    var value; // Type: clearValues
    value = GC.Spread.Sheets.Commands.clearValues;
    var clearValues : clearValues;
    Example
    The following examples clear cells.
    //Add data
    for (var col = 1; col < 6; col++) {
        for (var row = 2; row < 11; row++) {
            activeSheet.setValue(row, col, row + col);
        }
    }
    
    $("#button1").click(function () {
    spread.options.allowUndo = true;
    spread.commandManager().execute({cmd: "clearValues", sheetName: "Sheet1", ranges: [new GC.Spread.Sheets.Range(8, 5, 2, 1)]});
        });
    
    <input type="button" id="button1" value="button1"/>
    //Add data
    for (var col = 1; col < 6; col++) {
        for (var row = 2; row < 11; row++) {
            activeSheet.setValue(row, col, row + col);
        }
    }
    
    $("#button1").click(function () {
    spread.options.allowUndo = true;
    //Select a block of cells first
    spread.commandManager().execute({cmd: "clearValues", sheetName: "Sheet1", ranges: activeSheet.getSelections()});
        });
    
    <input type="button" id="button1" value="button1"/>
    See Also

    Reference

    Commands type