-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[datagrid] v7 API: update GridColDef
methods signatures
#10741
Comments
valueGetter
and valueFormatter
valueGetter
and valueFormatter
Looking at the
If I understand correctly, only the first 3 could improve performance, as the rest of them are not called on every row. |
Yes sounds good. I'm open to either option for the ones that don't affect performance, though if we can make it consistent it would be nice.
For |
Good point, in case of a large amount of data this could affect performance. |
Yeah, with - renderCell?: (params: GridRenderCellParams<R, V, F>) => React.ReactNode;
+ renderCell?: (
+ value: V,
+ row: R,
+ column: GridColDef<R, V, F>,
+ apiRef: React.MutableRefObject<GridApiCommunity>,
+ ) => React.ReactNode; But the DX is not great if you need to get something you previously got in
Is this recommended? renderCell: (value, row, column, apiRef) => {
const rowId = apiRef.current.getRowId(row);
const cellParams = apiRef.current.getCellParams(rowId, column.field);
const { hasFocus } = cellParams;
} This feels like a much worse DX to me. Another thing with mui-x/packages/grid/x-data-grid-premium/src/hooks/features/aggregation/wrapColumnWithAggregation.tsx Line 114 in a6f1170
We will have to pass it as a fifth parameter to renderCell?: (
value: V,
row: R,
column: GridColDef<R, V, F>,
apiRef: React.MutableRefObject<GridApiCommunity>,
+ aggregation?: GridAggregationCellMeta
) => React.ReactNode; I struggle to rationalize these changes on Pros:
Cons:
What do you think? |
Yes ok let's leave it out for now. I'll benchmark the potential impact before bringing that one up again. Sidenote, we're passing |
I propose the following scope then:
- valueGetter?: (params: GridValueGetterParams<R, any>) => V;
+ valueGetter?: (value: V, row: R, column: GridColDef<R, V, F>, apiRef: React.MutableRefObject<GridApiCommunity>) => V;
- groupingValueGetter?: (params: GridGroupingValueGetterParams<R, V>) => GridKeyValue | null | undefined;
+ groupingValueGetter?: (value: V, row: R, column: GridColDef<R, V, F>, apiRef: React.MutableRefObject<GridApiPremium>) => GridKeyValue | null | undefined;
- valueFormatter?: (params: GridValueFormatterParams<V>) => F;
+ valueFormatter?: (value: V, row: R, column: GridColDef<R, V, F>, apiRef: React.MutableRefObject<GridApiCommunity>) => F;
- valueSetter?: (params: GridValueSetterParams<R, V>) => R;
+ valueSetter?: (value: V, row: R, column: GridColDef<R, V, F>, apiRef: React.MutableRefObject<GridApiCommunity>) => R;
- valueParser?: (value: F | undefined, params?: GridCellParams<R, V, F>) => V;
+ valueParser?: (value: F | undefined, row: R, column: GridColDef<R, V, F>, apiRef: React.MutableRefObject<GridApiCommunity>) => V;
- pastedValueParser?: (value: string, params: GridCellParams<R, V, F>) => V | undefined;
+ pastedValueParser?: (value: string, row: R, column: GridColDef<R, V, F>, apiRef: React.MutableRefObject<GridApiPremium>) => V | undefined;
|
valueGetter
and valueFormatter
GridColDef
methods signatures
Did you mean leaving out only the |
Just |
To be able to optimize the performance of the filter & quickfilter, we need to change the API of those two column properties to match the API used for
getApplyFilterFn
.Search keywords:
The text was updated successfully, but these errors were encountered: