diff --git a/src/components/Table.astro b/src/components/Table.astro index d6757be..fabc8a0 100644 --- a/src/components/Table.astro +++ b/src/components/Table.astro @@ -73,7 +73,13 @@ const id = `table-${Math.random().toString(36).slice(2, 9)}`; col.width ? `width:${col.width}` : "" } data-sort-key={ - col.sortable ? col.key : undefined + col.sortable + ? col.alias + ? col.alias + + "." + + (col.key as any) + : col.key + : undefined } >
diff --git a/src/types/table/types.ts b/src/types/table/types.ts index 495f736..cfbbb3e 100644 --- a/src/types/table/types.ts +++ b/src/types/table/types.ts @@ -14,6 +14,7 @@ export type ClassNames = { export interface Column { key: keyof T | string; label: string; + alias?: string; path?: string; sortable?: boolean; searchable?: boolean;