JavaScript Data GridDropdown cell type
Collect user input with a searchable list of choices, by using the dropdown cell type.
Overview
The dropdown cell type is based on an autocomplete cell type and can also be searchable.
Usage
This example shows the usage of the dropdown feature. Dropdown is based on Autocomplete cell type. All options used by autocomplete
cell type apply to dropdown
as well.
Internally, cell {type: 'dropdown'}
is equivalent to cell {type: 'autocomplete', strict: true, filter: false}
. Therefore you can think of dropdown
as a searchable <select>
.
The source
option
The source
option can be provided in two formats:
Array of values
You can provide the source
option as an array of values that will be used as the dropdown options.
Array of objects
You can provide the source
option as an array of objects with key
and value
properties. The value
property will be used as the dropdown option, while the entire object will be used as the value of the cell.
API methods
When working with object-based dropdown data, you can use methods like getSourceData()
, getSourceDataAtCell()
, getSourceDataAtRow()
etc., to get the data in its original object format with both key
and value
properties. The getData()
method will return only the value
property's content.
TIP
Note: When the source
option is declared as an array of key
+ value
objects, the data in the edited cell should also be an object with key
+ value
properties.
Related articles
Related guides
Related API reference
- Configuration options:
- Core methods:
- Hooks: