Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add agParams to ColumnEditorFn #3834

Open
ghsolomon opened this issue Nov 19, 2024 · 0 comments
Open

Add agParams to ColumnEditorFn #3834

ghsolomon opened this issue Nov 19, 2024 · 0 comments

Comments

@ghsolomon
Copy link
Contributor

agParams is a required property of EditorProps:

export interface EditorProps<InputPropsT extends HoistInputProps> extends HoistProps {
/** Column in StoreRecord being edited. */
column: Column;
/** Owning GridModel of record being edited. */
gridModel: GridModel;
/** StoreRecord being edited. */
record: StoreRecord;
/** Props to pass through to the underlying HoistInput component */
inputProps: InputPropsT;
agParams: CustomCellEditorProps;
}

However, it is not included in the ColumnEditorFn params interface:

export type ColumnEditorFn = (params: {
record: StoreRecord;
column: Column;
gridModel: GridModel;
}) => ReactElement;

agParams appear to be passed here so should probably just be included as a required property of ColumnEditorFn's params interface:

ret.cellEditor = forwardRef((agParams: CustomCellEditorProps, ref) => {
const props = {
record: agParams.data as StoreRecord,
gridModel,
column: this,
agParams,
ref
};
// Can be a component or elem factory/ ad-hoc render function.
if ((editor as any).isHoistComponent)
return createElement(editor, props as Attributes);
if (isFunction(editor)) return editor(props);
throw XH.exception('Column editor must be a HoistComponent or a render function');
});

If we suspect there are times when agParams are not passed, we should make agParams an optional property of EditorProps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant