[]
↳ ButtonList
• new ButtonList()
Represents an editable buttonList cell.
example
//This example creates a buttonList cell.
var cellType2 = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType2.items([{text:"a",value:1},{text:"b",value:2},{text:"c",value:3}]);
activeSheet.getCell(2, 2).cellType(cellType2);
• typeName: string
Represents the type name string used for supporting serialization.
▸ activateEditor(editorContext
, cellStyle
, cellRect
, context?
): void
Activates the editor, including setting properties or attributes for the editor and binding events for the editor.
Name | Type | Description |
---|---|---|
editorContext |
HTMLElement |
The DOM element that was created by the createEditorElement method. |
cellStyle |
Style |
The cell's actual style. |
cellRect |
Rect |
The cell's layout information. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
void
▸ createEditorElement(context?
): HTMLElement
Creates a DOM element then returns it.
Name | Type | Description |
---|---|---|
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
HTMLElement
Returns a DOM element.
▸ deactivateEditor(editorContext
, context?
): void
Deactivates the editor, such as unbinding events for editor.
Name | Type | Description |
---|---|---|
editorContext |
HTMLElement |
The DOM element that was created by the createEditorElement method. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
void
▸ direction(value?
): any
Gets or sets the buttonList list's orders.
example
//This example creates a buttonList list cell.
var cellType2 = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType2.items([{text:"a",value:1},{text:"b",value:2},{text:"c",value:3}]);
cellType2.direction(GC.Spread.Sheets.CellTypes.Direction.vertical);
activeSheet.getCell(2, 2).cellType(cellType2);
Name | Type | Description |
---|---|---|
value? |
Direction |
Whether the order is vertical. |
any
If no value is set, returns whether the buttonList list's orders is vertical; otherwise, returns the checkbox list cellType.
▸ focus(editorContext
, context?
): void
Focuses the editor DOM element.
Name | Type | Description |
---|---|---|
editorContext |
HTMLElement |
The DOM element that was created by the createEditorElement method. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
void
▸ format(value
, format
, formattedData?
, context?
): string
Formats a value with the specified format to a string.
Name | Type | Description |
---|---|---|
value |
any |
The object value to format. |
format |
string | GeneralFormatter |
The format. |
formattedData? |
FormattedData |
the formatted data. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
string
Returns the formatted string.
▸ fromJSON(settings
): void
Loads the object state from the specified JSON string.
Name | Type | Description |
---|---|---|
settings |
any |
The cell type data from deserialization. |
void
▸ getAutoFitHeight(value
, text
, cellStyle
, zoomFactor
, context?
): number
Gets a cell's height that can be used to handle the row's automatic fit.
Name | Type | Description |
---|---|---|
value |
any |
The cell's value. |
text |
string |
The cell's text. |
cellStyle |
Style |
The cell's actual value. |
zoomFactor |
number |
The current sheet's zoom factor. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
number
Returns the cell's height that can be used to handle the row's automatic fit.
▸ getAutoFitWidth(value
, text
, cellStyle
, zoomFactor
, context?
): number
Gets a cell's width that can be used to handle the column's automatic fit.
Name | Type | Description |
---|---|---|
value |
any |
The cell's value. |
text |
string |
The cell's text. |
cellStyle |
Style |
The cell's actual value. |
zoomFactor |
number |
The current sheet's zoom factor. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
number
Returns the cell's width that can be used to handle the column's automatic fit.
▸ getEditorValue(editorContext
, context?
): any
Gets the editor's value.
Name | Type | Description |
---|---|---|
editorContext |
HTMLElement |
The DOM element that was created by the createEditorElement method. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
any
Returns the editor's value.
▸ getHitInfo(x
, y
, cellStyle
, cellRect
, context?
): IHitTestCellTypeHitInfo
Gets the cell type's hit information.
Name | Type | Description |
---|---|---|
x |
number |
x-coordinate of pointer's current location relative to the canvas. |
y |
number |
y-coordinate of pointer's current location relative to the canvas. |
cellStyle |
Style |
The current cell's actual style. |
cellRect |
Rect |
The current cell's layout information. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
Returns an object that contains the x, y, row, col, cellRect, and sheetArea parameters, and a value to indicate isReservedLocation.
isReservedLocation is true
if the hit test is in a special area that the cell type needs to handle; otherwise, false
.
▸ isEditingValueChanged(oldValue
, newValue
, context?
): boolean
Whether the editing value has changed.
Name | Type | Description |
---|---|---|
oldValue |
any |
Old editing value. |
newValue |
any |
New editing value. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
boolean
true
if oldValue equals newValue; otherwise, false
.
▸ isFlowLayout(value?
): any
Gets or sets the buttonList list's layout is autofit.
example
//This example creates a buttonList list cell.
var cellType2 = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType2.items([{text:"a",value:1},{text:"b",value:2},{text:"c",value:3}]);
cellType2.isFlowLayout(true);
activeSheet.getCell(2, 2).cellType(cellType2);
Name | Type | Description |
---|---|---|
value? |
boolean |
Whether the layout is autofit. |
any
If no value is set, returns whether the layout is autofit, returns the buttonList list cellType.
▸ isImeAware(context?
): boolean
Whether this cell type is aware of IME.
Name | Type | Description |
---|---|---|
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
boolean
true
if the cell type is aware of IME; otherwise, false
.
▸ isReservedKey(e
, context?
): boolean
Whether the cell type handles the keyboard event itself.
Name | Type | Description |
---|---|---|
e |
KeyboardEvent |
The KeyboardEvent. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
boolean
Returns true
if the cell type handles the keyboard event itself; otherwise, false
.
▸ itemSpacing(value?
): any
Gets or sets the space for two items in the buttonList.
example
//This example creates a buttonList cell.
var cellType2 = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType2.items([{text:"a",value:1},{text:"b",value:2},{text:"c",value:3}]);
cellType2.itemSpacing({
horizontal:80,
vertical:20
});
Name | Type | Description |
---|---|---|
value? |
IItemSpacing |
the space for two items in the buttonList. |
any
If no value is set, returns the space for two items in the buttonList; otherwise, returns the buttonList cellType.
▸ items(items?
): any
Gets or sets the items for the buttonList list.
example
//This example creates a buttonList list cell.
var cellType2 = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType2.items([{text:"a",value:1},{text:"b",value:2},{text:"c",value:3}]);
activeSheet.getCell(2, 2).cellType(cellType2);
Name | Type | Description |
---|---|---|
items? |
string [] | ICelltypeItemOption [] |
The items for the buttonList list. |
any
If no value is set, returns the items array; otherwise, returns the buttonList list cellType.
▸ maxColumnCount(value?
): any
Gets or sets the items for the buttonList list's column count.
example
//This example creates a buttonList list cell.
var cellType2 = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType2.items([{text:"a",value:1},{text:"b",value:2},{text:"c",value:3}]);
cellType2.maxColumnCount(2);
activeSheet.getCell(2, 2).cellType(cellType2);
Name | Type | Description |
---|---|---|
value? |
number |
The column count for the buttonList list. |
any
If no value is set, returns the column count; otherwise, returns the buttonList list cellType.
▸ maxRowCount(value?
): any
Gets or sets the items for the buttonList list's row count.
example
//This example creates buttonList list cell.
var cellType2 = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType2.items([{text:"a",value:1},{text:"b",value:2},{text:"c",value:3}]);
cellType2.maxRowCount(2);
activeSheet.getCell(2, 2).cellType(cellType2);
Name | Type | Description |
---|---|---|
value? |
number |
The row count for the buttonList list. |
any
If no value is set, returns the row count; otherwise, returns the buttonList list cellType.
▸ padding(value?
): any
Gets or sets the buttonList's padding in pixels relative to the cell.
example
//This example creates a buttonList cell and sets its padding.
var cellType = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType.padding("5");
activeSheet.getCell(0, 2).cellType(cellType);
activeSheet.setColumnWidth(2, 120.0,GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setRowHeight(0, 90.0,GC.Spread.Sheets.SheetArea.viewport);
Name | Type | Description |
---|---|---|
value? |
string |
The buttonList's padding relative to the cell. |
any
If no value is set, returns the padding in pixels; otherwise, returns the buttonList cell type.
▸ paint(ctx
, value
, x
, y
, w
, h
, style
, context?
): void
Paints a cell on the canvas.
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D |
The canvas's two-dimensional context. |
value |
any |
The cell's value. |
x |
number |
x-coordinate relative to the canvas. |
y |
number |
y-coordinate relative to the canvas. |
w |
number |
The cell's width. |
h |
number |
The cell's height. |
style |
Style |
The cell's actual style. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
void
▸ paintContent(ctx
, value
, x
, y
, w
, h
, style
, context?
): void
Paints the cell content area on the canvas.
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D |
The canvas's two-dimensional context. |
value |
any |
The cell's value. |
x |
number |
x-coordinate relative to the canvas. |
y |
number |
y-coordinate relative to the canvas. |
w |
number |
The cell content area's width. |
h |
number |
The cell content area's height. |
style |
Style |
The cell's actual style. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
void
▸ parse(text
, formatStr
, context?
): any
Parses the text with the specified format string to an object.
Name | Type | Description |
---|---|---|
text |
string |
The parse text string. |
formatStr |
string |
The parse format string. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
any
The parsed object.
▸ processKeyDown(event
, context?
): boolean
Processes key down in display mode.
Name | Type | Description |
---|---|---|
event |
KeyboardEvent |
The KeyboardEvent. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
boolean
Returns true
if the process is successful; otherwise, false
.
▸ processKeyUp(event
, context?
): boolean
Processes key up in display mode.
Name | Type | Description |
---|---|---|
event |
KeyboardEvent |
The KeyboardEvent. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
boolean
Returns true
if the process is successful; otherwise, false
.
▸ processMouseDown(hitInfo
): boolean
Processes mouse down in display mode.
Name | Type | Description |
---|---|---|
hitInfo |
IHitTestCellTypeHitInfo |
The hit test information returned by the getHitInfo method. See the Remarks for more information. |
boolean
Returns true
if the process is successful; otherwise, false
.
▸ processMouseEnter(hitInfo
): boolean
Processes mouse enter in display mode.
Name | Type | Description |
---|---|---|
hitInfo |
IHitTestCellTypeHitInfo |
The hit test information returned by the getHitInfo method. See the Remarks for more information. |
boolean
Returns true
if the process is successful; otherwise, false
.
▸ processMouseLeave(hitInfo
): boolean
Processes mouse leave in display mode.
Name | Type | Description |
---|---|---|
hitInfo |
IHitTestCellTypeHitInfo |
The hit test information returned by the getHitInfo method. See the Remarks for more information. |
boolean
Returns true
if the process is successful; otherwise, false
.
▸ processMouseMove(hitInfo
): boolean
Processes mouse move in display mode.
Name | Type | Description |
---|---|---|
hitInfo |
IHitTestCellTypeHitInfo |
The hit test information returned by the getHitInfo method. See the Remarks for more information. |
boolean
Returns true
if the process is successful; otherwise, false
.
▸ processMouseUp(hitInfo
): boolean
Processes mouse up in display mode.
Name | Type | Description |
---|---|---|
hitInfo |
IHitTestCellTypeHitInfo |
The hit test information returned by the getHitInfo method. See the Remarks for more information. |
boolean
Returns true
if the process is successful; otherwise, false
.
▸ selectAll(editorContext
, context?
): void
Selects all the text in the editor DOM element.
Name | Type | Description |
---|---|---|
editorContext |
HTMLElement |
The DOM element that was created by the createEditorElement method. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
void
▸ selectedBackColor(value?
): any
Gets or sets the selected buttonList's background color.
example
//This example creates a buttonList cell.
var cellType = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType.selectedBackColor("#FFFF00");
activeSheet.getCell(0, 2).cellType(cellType);
Name | Type | Description |
---|---|---|
value? |
string |
The selected buttonList's background color. |
any
If no value is set, returns the background color; otherwise, returns the buttonList cell type.
▸ selectedForeColor(value?
): any
Gets or sets the selected buttonList's fore color.
example
//This example creates a buttonList cell.
var cellType = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType.selectedForeColor("#FFFF00");
activeSheet.getCell(0, 2).cellType(cellType);
Name | Type | Description |
---|---|---|
value? |
string |
The selected buttonList's fore color. |
any
If no value is set, returns the fore color; otherwise, returns the buttonList cell type.
▸ selectionMode(value?
): any
Gets or sets the buttonList's select mode.
example
//This example creates a buttonList cell.
var cellType = new GC.Spread.Sheets.CellTypes.ButtonList();
cellType.selectionMode(GC.Spread.Sheets.CellTypes.SelectionMode.single);
activeSheet.getCell(0, 2).cellType(cellType);
Name | Type | Description |
---|---|---|
value? |
SelectionMode |
The selected buttonList's select mode. |
any
If no value is set, returns the select mode; otherwise, returns the buttonList cell type.
▸ setEditorValue(editorContext
, value
, context?
): void
Sets the editor's value.
Name | Type | Description |
---|---|---|
editorContext |
HTMLElement |
The DOM element that was created by the createEditorElement method. |
value |
any |
The value returned from the active cell. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
void
▸ toJSON(): any
Saves the object state to a JSON string.
any
The cell type data.
▸ updateEditor(editorContext
, cellStyle
, cellRect
, context?
): Rect
Updates the editor's size.
Name | Type | Description |
---|---|---|
editorContext |
HTMLElement |
The DOM element that was created by the createEditorElement method. |
cellStyle |
Style |
The cell's actual style. |
cellRect |
Rect |
The cell's layout information. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
Returns the new size for cell wrapper element, it should contain two properties 'width' and 'height'.
▸ updateEditorContainer(editorContext
, editorBounds
, cellStyle
): void
Updates the cell wrapper element size.
Name | Type | Description |
---|---|---|
editorContext |
HTMLElement |
The DOM element that was created by the createEditorElement method. |
editorBounds |
Rect |
The cell wrapper element's new size. |
cellStyle |
Style |
The cell's actual style. |
void
▸ updateImeMode(editorContext
, imeMode
, context?
): void
Updates the editor's ime-mode.
Name | Type | Description |
---|---|---|
editorContext |
HTMLElement |
The DOM element that was created by the createEditorElement method. |
imeMode |
ImeMode |
The ime-mode from cell's actual style. |
context? |
any |
The context associated with the cell type. See the Remarks for more information. |
void