Skip to content

Commit

Permalink
Merge pull request #283 from EMCECS/bugfix-OBSDEF-44980
Browse files Browse the repository at this point in the history
  • Loading branch information
akate1 authored May 15, 2024
2 parents e49d8d3 + 05915c9 commit 143977b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dellstorage/clarity-react",
"version": "1.2.12",
"version": "1.2.13",
"description": "React components for Clarity UI",
"license": "Apache-2.0",
"private": false,
Expand Down
15 changes: 14 additions & 1 deletion src/datagrid/DataGrid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
paginationRowsWithLinks,
storeForDetailPane,
paginationDetailswithPageSizes,
paginationDetailsForLessThan10Records,
} from "./DataGridStoriesData";
import {CustomFilter} from "./CustomFilter";
import {CustomFilterMulti} from "./CustomFilterMulti";
Expand Down Expand Up @@ -421,14 +422,26 @@ storiesOf("DataGrid", module)
</div>
))
.add("Grid with pagination and custom page size", () => (
<div style={{width: "80%"}}>
<div style={{width: "80%", paddingLeft: "1rem"}}>
<br />
<span> {"Datagrid with custom page sizes and more than or equal to 10 records."} </span>
<DataGrid
columns={normalColumns}
rows={paginationRows.slice(0, 10)}
pagination={paginationDetailswithPageSizes}
itemText={"Users"}
footer={{showFooter: true}}
/>
<br /> <br />
<span> {"Datagrid with custom page sizes and less than 10 records."} </span>
<DataGrid
columns={normalColumns}
rows={paginationRows.slice(0, 6)}
pagination={paginationDetailsForLessThan10Records}
itemText={"Users"}
footer={{showFooter: true}}
/>
<br /> <br />
</div>
))
.add("Grid with pagination and compact footer", () => (
Expand Down
2 changes: 1 addition & 1 deletion src/datagrid/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ export class DataGrid extends React.PureComponent<DataGridProps, DataGridState>
const {totalItems, pageSize, pageSizes} = pagination;
if (totalItems && pageSize) {
// Render pagination footer if pageSizes are given or if totalItems are greater than pageSize
renderPaginationFooter = pageSizes ? totalItems > 0 : totalItems >= pageSize;
renderPaginationFooter = pageSizes ? totalItems >= DEFAULT_PAGE_SIZE : totalItems >= pageSize;
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/datagrid/DataGridStoriesData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,14 @@ export const paginationDetailswithPageSizes: DataGridPaginationProps = {
pageSizes: ["10", "20", "50", "100", CUSTOM_PAGE_SIZE_OPTION],
};

export const paginationDetailsForLessThan10Records: DataGridPaginationProps = {
totalItems: 6,
getPageData: getPageDataForCustomPageSize,
pageSize: 10,
currentPage: 1,
pageSizes: ["10", "20", "50", "100", CUSTOM_PAGE_SIZE_OPTION],
};

export const paginationDetailsWithCompactFooter: DataGridPaginationProps = {
totalItems: paginationRows.length,
getPageData: getPageData,
Expand Down

0 comments on commit 143977b

Please sign in to comment.