Closed Stewioie closed 1 year ago
@Stewioie the easy way is to flatten your items array, sth like :
liftsFlatten = lifts.map((item) => {
return { ...item, buildingName: item.building.name };
});
and update your liftColumns
accordingly
@Stewioie
The other option is to use columnFilter="{external: true}"
and handle (columnFilterValueChange)
with your custom filter function (for all columns).
One drawback of this approach - you'll also need an external columnSorter
to sort this specific column (and rest of the columns).
@Stewioie starting from v4.3.16 (not documented yet) you can also pass custom functions for column filter and sorter:
liftColumns = [
...
{
key: 'building',
filter: (item: ILitf, value: string) => item.building?.name?.toLowerCase().startsWith(value.toLowerCase().trim()),
sorter: (itemA: ILitf, itemB: ILitf) => {
const a = itemA.building?.name?.toLowerCase() ?? ''
const b = itemB.building?.name?.toLowerCase() ?? ''
return a > b ? 1 : b > a ? -1 : 0;
}
},
...
];
@Stewioie the easy way is to flatten your items array, sth like :
liftsFlatten = lifts.map((item) => { return { ...item, buildingName: item.building.name }; });
and update your
liftColumns
accordingly
Thanks it works
Operating System Windows 10 21H2 Browser Chrome v110.0.5481.178
For column "building" the table filter wont show any results... for the rest of the columns its ok