Similar to the checkbox list and radio list usage, the ButtonList CellType can do single or multiple selection.
Use the following code to create a buttonList cell:
var cellType = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType.items([{text:"a",value:1},{text:"b",value:2},{text:"c",value:3}]);
activeSheet.getCell(2, 2).cellType(cellType);
The ButtonList Cell Type includes items, isFlowLayout, maxRowCount, maxColumnCount, itemSpacing, and direction methods, similar to the Radio List Cell Type and Checkbox List Cell Type.
var cellType = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType.items([{text:"a",value:1},{text:"b",value:2},{text:"c",value:3}]);
cellType.isFlowLayout(false);
cellType.maxColumnCount(2);
cellType.direction(GC.Spread.Sheets.CellTypes.Direction.vertical);
cellType.itemSpacing({
horizontal:80,
vertical:20
});
activeSheet.getCell(2, 2).cellType(cellType);
You can use the padding method to get or set the padding in pixels with css-like format.
You can use the selectedBackColor and selectedForeColor methods to configure the selected style.
You can use the selectionMode method to set the single select or multiple select mode.
var cellType = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType.items([{text:"a",value:1},{text:"b",value:2},{text:"c",value:3}]);
cellType.padding("5, 2, 0, 2");
cellType.selectedBackColor("#FFFF00");
cellType.selectedForeColor("#FFFF00");
cellType.selectionMode(GC.Spread.Sheets.CellTypes.SelectionMode.single);
activeSheet.getCell(2, 2).cellType(cellType);
Submit and view feedback for