Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

You can use a combo box cell to display a drop-down list.

You can also make the combo cell editable. You can type in the edit portion of the cell and the matching item in the list is selected automatically.

If the item width is less than the cell width, then the item width is set to the cell width; otherwise, the item width is equal to the width of the longest item.
The maximum number of visible items in the drop-down list is 20. Use the up or down arrow keys to select items when the drop-down list is displayed. The left and right arrow keys commit the selected item and move to the next or previous cell. The Enter key also commits the selected item and the Esc key cancels the selected item.
The arrow keys may not behave the same when using rapid input mode. If the cell's editor status is EditorStatus.Enter, pressing the left or right arrow key ends editing and navigates to the previous or next cell. If the editor status is EditorStatus.Edit, pressing the left or right arrow key does not end editing.
Using Code
The following example creates a combo box cell with a list of items.

JavaScript

Copy Code

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="308e7741-d092-4717-91d6-f4fe29e58e81"><ac:plain-text-body><![CDATA[

var cellType2 = new GC.Spread.Sheets.CellTypes.ComboBox();cellType2.items(["a","b","c"]);activeSheet.getCell(2, 2).cellType(cellType2);

 

]]></ac:plain-text-body></ac:structured-macro>

The following example creates an editable combo box cell with a list of items.

JavaScript

Copy Code

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6a58a696-e032-4a1f-99c6-c39e49092943"><ac:plain-text-body><![CDATA[

var items2 = ["a", "ab", "abc", "apple", "boy", "cat", "dog"];var eComboBoxCellType = new GC.Spread.Sheets.CellTypes.ComboBox().items(items2).editable(true); activeSheet.getCell(1, 3).cellType(eComboBoxCellType);activeSheet.setColumnWidth(3,120);

 

]]></ac:plain-text-body></ac:structured-macro>

See Also
Using Rapid Input Mode
Using Edit Mode Always
ComboBox class

  • No labels