Skip to content

Editor Dropdown

ColumnRegular (Extended from @revolist/revogrid)

Section titled “ColumnRegular (Extended from @revolist/revogrid)”
interface ColumnRegular {
/**
* Configuration for dropdown editor
*/
dropdown?: DropdownColumnConfig;
/**
* Column-select compatible dropdown source.
*/
source?: DropdownColumnSourceEntry[];
/**
* Object source label field used by dropdown columns.
*/
labelKey?: string;
/**
* Object source value field used by dropdown columns.
*/
valueKey?: string
}
export type DropdownColumnSourceEntry = string | Record<string, unknown>;

Section titled “DropdownColumnProps (Extended from index.ts)”

Dropdown configuration for grid columns. See the Dropdown Editor guide for examples. disabled accepts boolean | ((context: ColumnDataSchemaModel) => boolean). Callbacks must be synchronous and free of side effects. Grid/column readonly always blocks opening even when this callback returns false. Standalone properties and item-level disabling are documented in the Dropdown API.

/**
* Dropdown configuration for grid columns. See the
* [Dropdown Editor guide](/guides/editors/editor-dropdown/) for examples.
* `disabled` accepts `boolean | ((context: ColumnDataSchemaModel) = > boolean)`.
* Callbacks must be synchronous and free of side effects. Grid/column readonly
* always blocks opening even when this callback returns false. Standalone
* properties and item-level disabling are documented in the
* [Dropdown API](/api/dropdown/).
*/
export type DropdownColumnProps = Omit<DropdownProps, 'disabled'> & {
/**
* Block dropdown opening, selection, and multiselect removal. Defaults to false.
* A synchronous callback receives the current ColumnDataSchemaModel, with
* `value` taken from the stored row value rather than a parsed display label.
* Grid and column readonly rules always take precedence. Use column.readonly
* to also block paste, Delete, and other cell edits.
* @example
* disabled: ({ model }) => model.locked === true
*/
disabled?: ReadOnlyFormat;
/** Mirror a cell template in dropdown options and selected values. */
syncCellTemplate?: boolean;
/** Optional external template to mirror instead of the column cell template. */
cellTemplate?: ColumnRegular['cellTemplate'];
};

Section titled “DropdownColumnConfig (Extended from index.ts)”

Per-column dropdown overrides; the source may be inherited from a column type.

/** Per-column dropdown overrides; the source may be inherited from a column type. */
export type DropdownColumnConfig = Omit<DropdownColumnProps, 'source'> & {
source?: DropdownColumnProps['source'];
};

normalizeDropdownOptions: (source?: unknown[], labelKey?: string | undefined, valueKey?: string | undefined) => DropdownOption[];

normalizeColumnDropdown: (column?: ColumnRegular<ColumnProp, DataType<any, ColumnProp>> | null | undefined) => DropdownColumnProps | undefined;

Resolve the authored value template behind a dropdown column adapter.

resolveColumnDropdownCellTemplate: (column?: ColumnRegular<ColumnProp, DataType<any, ColumnProp>> | null | undefined) => CellTemplate<DataType<any, ColumnProp>> | undefined;

Find normalized dropdown metadata for a stored column value.

findColumnDropdownOption: (column: ColumnRegular<ColumnProp, DataType<any, ColumnProp>> | null | undefined, value: unknown) => DropdownOption | undefined;

Find normalized dropdown metadata by its authored display label.

findColumnDropdownOptionByLabel: (column: ColumnRegular<ColumnProp, DataType<any, ColumnProp>> | null | undefined, label: unknown) => DropdownOption | undefined;

Resolve the normalized dropdown contract for a grid cell context, including the exact renderers generated by syncCellTemplate. Resolves column disabled callbacks to booleans per cell and combines them with readonly restrictions.

resolveColumnDropdownProps: (data: ColumnDataSchemaModel<DataType<any, ColumnProp>, ColumnRegular<ColumnProp, DataType<any, ColumnProp>>, ColumnProp>, additionalData?: unknown) => DropdownProps | undefined;

editorDropdown: CellTemplate<DataType<any, ColumnProp>> | undefined;

Keep the dropdown cell adapter while replacing the template used for its selected value and options.

Formatting uses this when an advanced presentation decorates a dropdown cell: the adapter continues to render its expand control instead of being replaced by the presentation renderer itself.

withColumnDropdownCellTemplate: (column: ColumnRegular<ColumnProp, DataType<any, ColumnProp>>, cellTemplate: CellTemplate<DataType<any, ColumnProp>>) => ColumnRegular<ColumnProp, DataType<any, ColumnProp>> | undefined;

class DropdownEditor {
async componentDidRender(): Promise<void>;
getValue();
/** Prevent implicit saves when the cell has become disabled. */
beforeAutoSave();
beforeDisconnect();
disconnectedCallback();
render(h: HyperFunc<VNode>, additionalData?: unknown);
}

dropdownEditor: typeof DropdownEditor;

Column type for dropdown editor

Key Features:

  • Cell Template: Uses the editorDropdown template for rendering the dropdown editor.
  • Cell Properties: Applies a small padding to the cell to prevent layout issues.
  • Disabled: Honors grid/column readonly and per-cell dropdown disabling.
ColumnDropdown: {
beforeSetup: (column: ColumnRegular<ColumnProp, DataType<any, ColumnProp>>) => void;
cellTemplate: CellTemplate<DataType<any, ColumnProp>>;
editor: typeof DropdownEditor;
cellProperties: () => { style: { padding: string; }; };
};