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)”
export type DropdownColumnProps = DropdownProps & {
/** 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.

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

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

class DropdownEditor {
async componentDidRender(): Promise<void>;
getValue();
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.
  • Readonly: Ensures the dropdown is not editable by default.
ColumnDropdown: {
beforeSetup: (column: ColumnRegular<ColumnProp, DataType<any, ColumnProp>>) => void;
cellTemplate: CellTemplate<DataType<any, ColumnProp>>;
editor: typeof DropdownEditor;
cellProperties: () => { style: { padding: string; }; };
};