options
Optional. Specifies a set of options to be displayed in the editor of a cell
note
The property is required if you specify editorType: "select" | "combobox" | "multiselect"
.
info
If the newOptions
property is enabled in the editorConfig
object, all new options will be displayed in the editor regardless of the initialized options.
Usage
options?: (string | { id: string | number, value: string })[] |
(column: ICol, row?: IRow) => (string | { id: string | number, value: string })[];
Parameters
The property can be:
- an array of string values
- an array of objects with a set of key:value pairs - attributes of options and their values:
- The id attribute sets the id for the option
- The value attribute sets the value to be displayed both in the editor and in the grid cell. If the id of the option is specified in the data set, the value will also be displayed in the cell on Grid initialization
- a function which takes two parameters:
- column - (required) an object with the configuration of a column
- row - (optional) an object with all cells in a row and must return either an array of string values or an array of objects
Example
const grid = new dhx.Grid("grid_container", {
columns: [
{
id: "status", header: [{ text: "Status" }],
editorType: "select", options: [ "Done", "In Progress", "Not Started" ]
},
// more columns configuration objects
],
// more options
});
Related article: Editing Grid and separate columns
Related samples: