Skip to content

Added virtualization to DxcResultsetTable #2230

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import StatusBadge from "@/common/StatusBadge";
import reduced from "./examples/reduced";
import Link from "next/link";
import paginatorHidden from "./examples/paginatorHidden";
import virtualized from "./examples/virtualized";

const actionsType = `{
icon: string | SVG;
Expand Down Expand Up @@ -76,6 +77,24 @@ const sections = [
</td>
<td>-</td>
</tr>
<tr>
<td>
<DxcFlex direction="column" gap="var(--spacing-gap-xs)" alignItems="baseline">
<StatusBadge status="new" />
height
</DxcFlex>
</td>
<td>
<TableCode>string</TableCode>
</td>
<td>
A fixed height must be set to enable virtualization. If no height is provided, the table will
automatically adjust to the height of its content, and virtualization will not be applied.
</td>
<td>
<td>-</td>
</td>
</tr>
<tr>
<td>
<DxcFlex direction="column" gap="var(--spacing-gap-xs)" alignItems="baseline">
Expand Down Expand Up @@ -287,6 +306,10 @@ const sections = [
title: "No paginator",
content: <Example example={paginatorHidden} defaultIsVisible />,
},
{
title: "Virtualized",
content: <Example example={virtualized} defaultIsVisible />,
},
],
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const code = `() => {
<DxcResultsetTable
columns={columns}
rows={rows}
></DxcResultsetTable>
/>
</DxcInset>
);
}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const code = `() => {
columns={columns}
rows={rows}
hidePaginator={true}
></DxcResultsetTable>
/>
</DxcInset>
);
}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const code = `() => {
columns={columns}
rows={rows}
mode="reduced"
></DxcResultsetTable>
/>
</DxcInset>
);
}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { DxcButton } from "@dxc-technology/halstack-react";

const cities = ["London", "New York", "Madrid", "Berlin", "Paris", "Tokyo"];
const names = ["Alice", "Bob", "Charlie", "Diana", "Evan", "Fiona"];
export const rows = Array.from({ length: 100000 }, (_, index) => {
const id = String(index + 1).padStart(6, "0");
const name = names[index % names.length];
const city = cities[index % cities.length];
return [
{ displayValue: id, sortValue: id },
{ displayValue: name, sortValue: name },
{ displayValue: city, sortValue: city },
{ displayValue: <DxcButton icon="delete" /> },
];
});
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const code = `() => {

return (
<DxcInset space="var(--spacing-padding-xl)">
<DxcResultsetTable columns={columns} rows={rows}></DxcResultsetTable>
<DxcResultsetTable columns={columns} rows={rows}/>
</DxcInset>
);
}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { DxcResultsetTable, DxcButton, DxcInset } from "@dxc-technology/halstack-react";
import { rows } from "./rows";

const code = `() => {
const columns = [
{ displayValue: "Id", isSortable: true },
{ displayValue: "Name", isSortable: true },
{ displayValue: "City", isSortable: true },
{ displayValue: "Actions", isSortable: false },
];

return (
<DxcInset space="var(--spacing-padding-xl)">
<DxcResultsetTable columns={columns} rows={rows} height="500px" itemsPerPage={10000}/>
</DxcInset>
);
}`;

const scope = {
DxcResultsetTable,
DxcButton,
DxcInset,
rows,
};

export default { code, scope };
Loading