diff --git a/src/components/Table.astro b/src/components/Table.astro
index b423151..d6757be 100644
--- a/src/components/Table.astro
+++ b/src/components/Table.astro
@@ -302,7 +302,8 @@ const id = `table-${Math.random().toString(36).slice(2, 9)}`;
.join(" ")}">`;
columns.forEach((col, colIndex) => {
- let value = row[col.key] ?? "";
+ let data = col.path ? row[col.path] : row;
+ let value = data[col.key] ?? "";
const renderers = columnsRendererKey
? window[columnsRendererKey]
@@ -346,7 +347,8 @@ const id = `table-${Math.random().toString(36).slice(2, 9)}`;
// 📱 Mobile
let card = `
`;
columns.forEach((col, colIndex) => {
- let value = row[col.key] ?? "";
+ let data = col.path ? row[col.path] : row;
+ let value = data[col.key] ?? "";
const renderers = columnsRendererKey
? window[columnsRendererKey]
diff --git a/src/pages/table.astro b/src/pages/table.astro
index fdedf8c..38edb20 100644
--- a/src/pages/table.astro
+++ b/src/pages/table.astro
@@ -298,6 +298,8 @@ const studentColumns = [
"button[id^='view-'], button[id^='edit-'], button[id^='delete-']",
);
+ console.log(buttons);
+
buttons.forEach((button) => {
const id = button.getAttribute("data-id");
diff --git a/src/types/table/types.ts b/src/types/table/types.ts
index ce856b0..495f736 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;
+ path?: string;
sortable?: boolean;
searchable?: boolean;
render?: (value: any, row: T) => string;