SpreadJS 15
Features / Cells / Cell Types / Check Box Cell
In This Topic
    Check Box Cell
    In This Topic

    You can display a check box in a cell using the check box cell. A check box cell displays a small check box that can have one of three states, checked, unchecked, or indeterminate. You can customize the check box by setting the text.

    Set the isThreeState method to true to display three states instead of two (checked or unchecked). You can also specify the alignment of the check box and the text with the textAlign method.

    Checkbox cell

    You can set the state of the check box in code with the value method as shown in the following table:

    Value State
    null Indeterminate
    0 Unchecked
    1 Checked

    You can change the size of a check box using the boxSize() method whose value can be set to any number or "auto". If the method is set to any illegal value, the check box size is not changed. The standard size of a check box in the check box cell type is 12*12. However, this method only works on Chrome, Edge, Firefox, Internet Explorer, Opera, Safari, Android webview, Chrome for Android, Firefox for Android, Opera for Android, Safari on IOS, and Samsung Internet browsers.

    Using Code

    This example creates a check box cell with three states.

    Copy Code
    // Get the activesheet
    var activeSheet = spread.getSheet(0);
    var cellType = new GC.Spread.Sheets.CellTypes.CheckBox();
    activeSheet.getCell(1, 1).cellType(cellType);
    //activeSheet.getCell(1, 1).value(1);
    See Also