Updated Table Component

This commit is contained in:
2025-11-16 22:36:14 +05:30
parent fd9fe2ca5c
commit 1a753e59a6
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -18,6 +18,7 @@ const {
tableClassNames = "", tableClassNames = "",
hideHeader = false, hideHeader = false,
rowClick = "", rowClick = "",
defaultSort = {},
} = Astro.props as TableProps<any>; } = Astro.props as TableProps<any>;
const id = `table-${Math.random().toString(36).slice(2, 9)}`; const id = `table-${Math.random().toString(36).slice(2, 9)}`;
@@ -155,6 +156,7 @@ const id = `table-${Math.random().toString(36).slice(2, 9)}`;
columnsRendererKey, columnsRendererKey,
classInfos, classInfos,
rowClick, rowClick,
defaultSort,
}} }}
> >
const start = () => { const start = () => {
@@ -173,7 +175,7 @@ const id = `table-${Math.random().toString(36).slice(2, 9)}`;
let rowsPerPage = pagignations let rowsPerPage = pagignations
? parseInt(pageSizeSelector.value) ? parseInt(pageSizeSelector.value)
: 9999; : 9999;
let sort = {}; // { key: "asc" | "desc" } let sort = defaultSort; // { key: "asc" | "desc" }
let totalRows = data.length; let totalRows = data.length;
let currentData = [...data]; let currentData = [...data];
+1
View File
@@ -38,6 +38,7 @@ export interface TableProps<T> {
tableClassNames?: string; tableClassNames?: string;
hideHeader?: boolean; hideHeader?: boolean;
rowClick?: string; rowClick?: string;
defaultSort?: Record<string, string>
} }
export type Sort = { export type Sort = {