Skip to content

Commit

Permalink
[DataGrid] Fix "No rows" displaying when all rows are pinned (#15335)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Xu <stevexugc@gmail.com>
Co-authored-by: Kenan Yusuf <kenan.m.yusuf@gmail.com>
  • Loading branch information
2 people authored and web-flow committed Dec 11, 2024
1 parent 634ba8c commit e61283d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useGridApiContext } from '../../utils/useGridApiContext';
import { useGridRootProps } from '../../utils/useGridRootProps';
import { gridExpandedRowCountSelector } from '../filter';
import { gridRowCountSelector, gridRowsLoadingSelector } from '../rows';
import { gridPinnedRowsCountSelector } from '../rows/gridRowsSelector';
import { GridLoadingOverlayVariant } from '../../../components/GridLoadingOverlay';
import { GridSlotsComponent } from '../../../models/gridSlotsComponent';

Expand All @@ -20,7 +21,8 @@ export const useGridOverlays = () => {

const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
const visibleRowCount = useGridSelector(apiRef, gridExpandedRowCountSelector);
const noRows = totalRowCount === 0;
const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
const noRows = totalRowCount === 0 && pinnedRowsCount === 0;
const loading = useGridSelector(apiRef, gridRowsLoadingSelector);

const showNoRowsOverlay = !loading && noRows;
Expand Down

0 comments on commit e61283d

Please sign in to comment.