Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance catalogue categories table view filtering #1125 #1132

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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