From fb7e03e91958c49f69249d37a73d2c4a2e8387e6 Mon Sep 17 00:00:00 2001 From: sai chand <60743144+sai6855@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:11:15 +0530 Subject: [PATCH] [DataGridPremium] Fix boolean cell not rendered in group rows (#12492) Co-authored-by: Andrew Cherniavskyi --- .../tests/rowGrouping.DataGridPremium.test.tsx | 16 ++++++++++++++++ .../src/components/cell/GridBooleanCell.tsx | 10 ++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/packages/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx index 601df5408868..9dc6dc7eef7c 100644 --- a/packages/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx @@ -163,6 +163,22 @@ describe(' - Row grouping', () => { expect(getColumnValues(0)).to.deep.equal(['Cat A (3)', '', '', '', 'Cat B (2)', '', '']); }); + it('should display icon on auto-generated row', () => { + render( + ({ ...row, isFilled: false }))} + />, + ); + + expect(screen.getByTestId('CloseIcon')).toBeVisible(); + }); + it('should respect the grouping criteria with colDef.groupable = false', () => { render( { return composeClasses(slots, getDataGridUtilityClass, classes); }; -interface GridBooleanCellProps - extends GridRenderCellParams, - Omit {} +interface GridBooleanCellProps extends GridRenderCellParams, Omit { + hideDescendantCount?: boolean; +} function GridBooleanCellRaw(props: GridBooleanCellProps) { const { @@ -40,6 +40,7 @@ function GridBooleanCellRaw(props: GridBooleanCellProps) { isEditable, hasFocus, tabIndex, + hideDescendantCount, ...other } = props; @@ -108,6 +109,7 @@ GridBooleanCellRaw.propTypes = { * If true, the cell is the active element. */ hasFocus: PropTypes.bool.isRequired, + hideDescendantCount: PropTypes.bool, /** * The grid row id. */ @@ -140,7 +142,7 @@ const GridBooleanCell = React.memo(GridBooleanCellRaw); export { GridBooleanCell }; export const renderBooleanCell: GridColDef['renderCell'] = (params: GridBooleanCellProps) => { - if (isAutoGeneratedRow(params.rowNode)) { + if (params.field !== '__row_group_by_columns_group__' && isAutoGeneratedRow(params.rowNode)) { return ''; }