Skip to content

Commit

Permalink
Merge pull request #1132 from ral-facilities/enhancement/enhance-cata…
Browse files Browse the repository at this point in the history
…logue-categories-table-view-filtering-#1125

 Enhance catalogue categories table view filtering #1125
  • Loading branch information
joshuadkitenge authored Nov 21, 2024
2 parents da93071 + 45113bf commit 1353abe
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/catalogue/category/catalogueCategoryTableView.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { MRT_Localization_EN } from 'material-react-table/locales/en';
import React from 'react';
import { CatalogueCategory } from '../../api/api.types';
import {
COLUMN_FILTER_FUNCTIONS,
COLUMN_FILTER_MODE_OPTIONS,
COLUMN_FILTER_VARIANTS,
TableBodyCellOverFlowTip,
TableCellOverFlowTipProps,
formatDateTimeStrings,
Expand Down Expand Up @@ -53,18 +56,21 @@ const CatalogueCategoryTableView = (props: CatalogueCategoryTableViewProps) => {
header: 'Name',
accessorFn: (row) => row.name,
id: 'name',
filterVariant: COLUMN_FILTER_VARIANTS.string,
filterFn: COLUMN_FILTER_FUNCTIONS.string,
columnFilterModeOptions: COLUMN_FILTER_MODE_OPTIONS.string,
size: 567.5,
},
{
header: 'Last modified',
accessorFn: (row) => new Date(row.modified_time),
id: 'modified_time',
filterVariant: 'datetime-range',
filterFn: 'betweenInclusive',
filterVariant: COLUMN_FILTER_VARIANTS.datetime,
filterFn: COLUMN_FILTER_FUNCTIONS.datetime,
columnFilterModeOptions: COLUMN_FILTER_MODE_OPTIONS.datetime,
size: 567.5,
enableGrouping: false,
Cell: ({ row }) =>
row.original.modified_time &&
formatDateTimeStrings(row.original.modified_time, true),
},
];
Expand All @@ -76,6 +82,7 @@ const CatalogueCategoryTableView = (props: CatalogueCategoryTableViewProps) => {
data: catalogueCategoryData ?? [], //data must be memoized or stable (useState, useMemo, defined outside of this component, etc.)
// Features
enableColumnOrdering: false,
enableColumnFilterModes: true,
enableColumnPinning: false,
enableTopToolbar: true,
enableFacetedValues: true,
Expand Down

0 comments on commit 1353abe

Please sign in to comment.