Updated Table Component
This commit is contained in:
@@ -18,6 +18,7 @@ const {
|
||||
tableClassNames = "",
|
||||
hideHeader = false,
|
||||
rowClick = "",
|
||||
defaultSort = {},
|
||||
} = Astro.props as TableProps<any>;
|
||||
|
||||
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,
|
||||
classInfos,
|
||||
rowClick,
|
||||
defaultSort,
|
||||
}}
|
||||
>
|
||||
const start = () => {
|
||||
@@ -173,7 +175,7 @@ const id = `table-${Math.random().toString(36).slice(2, 9)}`;
|
||||
let rowsPerPage = pagignations
|
||||
? parseInt(pageSizeSelector.value)
|
||||
: 9999;
|
||||
let sort = {}; // { key: "asc" | "desc" }
|
||||
let sort = defaultSort; // { key: "asc" | "desc" }
|
||||
let totalRows = data.length;
|
||||
let currentData = [...data];
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ export interface TableProps<T> {
|
||||
tableClassNames?: string;
|
||||
hideHeader?: boolean;
|
||||
rowClick?: string;
|
||||
defaultSort?: Record<string, string>
|
||||
}
|
||||
|
||||
export type Sort = {
|
||||
|
||||
Reference in New Issue
Block a user