Skip to content

Commit

Permalink
feat: add no matching msg (#448)
Browse files Browse the repository at this point in the history
Co-authored-by: YLui <[email protected]>
  • Loading branch information
flying3615 and YLui authored Nov 22, 2023
1 parent e15fe8a commit cacf3fc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/components/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface GridProps {
*/
selectColumnPinned?: ColDef["pinned"];
noRowsOverlayText?: string;
noRowsMatchingOverlayText?: string;
animateRows?: boolean;
rowHeight?: number;
rowClassRules?: GridOptions["rowClassRules"];
Expand Down Expand Up @@ -716,6 +717,7 @@ export const Grid = ({
headerRowHeight={headerRowCount * rowHeight}
filteredRowCount={event.api.getDisplayedRowCount()}
noRowsOverlayText={params.noRowsOverlayText}
noRowsMatchingOverlayText={params.noRowsMatchingOverlayText}
/>
);
}}
Expand Down
4 changes: 3 additions & 1 deletion src/components/GridNoRowsOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ export interface GridNoRowsOverlayProps {
rowCount: number | undefined | null;
filteredRowCount: number;
noRowsOverlayText: string | undefined;
noRowsMatchingOverlayText: string | undefined;
headerRowHeight: number;
}

export const GridNoRowsOverlay = (props: GridNoRowsOverlayProps) => {
if (props.loading) return <GridLoadingOverlayComponent headerRowHeight={props.headerRowHeight} />;
if (props.rowCount === 0) return <div>{props.noRowsOverlayText ?? "There are currently no rows"}</div>;
if (props.filteredRowCount === 0) return <div>All rows have been filtered</div>;
if (props.filteredRowCount === 0)
return <div>{props.noRowsMatchingOverlayText ?? "All rows have been filtered"}</div>;
return <span />;
};
6 changes: 5 additions & 1 deletion src/styles/GridTheme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
font-size: 14px;
}

.ag-row .ag-cell[aria-colindex="1"] {
.ag-row .ag-cell:first-of-type {
padding-left: 32px;
}

.ag-row .ag-cell:last-of-type {
padding-right: 32px;
}
}

0 comments on commit cacf3fc

Please sign in to comment.