Skip to content

Editor Dropdown

ColumnRegular (Extended from @revolist/revogrid)

Section titled “ColumnRegular (Extended from @revolist/revogrid)”
interface ColumnRegular {
/**
* Configuration for dropdown editor
*/
dropdown?: DropdownProps;
/**
* 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>;

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

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

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

class DropdownEditor {
async componentDidRender(): Promise<void>;
getValue();
beforeDisconnect();
disconnectedCallback();
render(h: HyperFunc<VNode>);
}

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: (props: CellTemplateProp<DataType<any, ColumnProp>, ColumnRegular<ColumnProp, DataType<any, ColumnProp>>, ColumnProp>) => { style: { padding: string; }; class: { disabled: false; }; };
};