mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
Adjusted
This commit is contained in:
@@ -230,19 +230,22 @@ export function SortIcon({ column }) {
|
||||
// ── Build columns dynamically from attributes ──────────────────────────────────
|
||||
const columnHelper = createColumnHelper();
|
||||
|
||||
export function buildColumns(attrs) {
|
||||
return attrs.map((attr) =>
|
||||
export function buildColumns(attributes, { cellOverrides = {} } = {}) {
|
||||
return attributes.map((attr) =>
|
||||
columnHelper.accessor(attr.field, {
|
||||
id: attr.field,
|
||||
header: attr.name,
|
||||
enableSorting: true,
|
||||
id: attr.field,
|
||||
header: attr.name,
|
||||
enableSorting: true,
|
||||
enableColumnFilter: true,
|
||||
filterFn: (row, colId, filterValue) => {
|
||||
if (!filterValue) return true;
|
||||
const val = String(row.getValue(colId) ?? "").toLowerCase();
|
||||
return val.includes(String(filterValue).toLowerCase());
|
||||
},
|
||||
cell: (info) => renderCell(attr, info.getValue()),
|
||||
cell: (info) =>
|
||||
cellOverrides[attr.field] // ← check override first
|
||||
? cellOverrides[attr.field](info)
|
||||
: renderCell(attr, info.getValue()),
|
||||
meta: { attr },
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user