
Security News
pnpm 10.12 Introduces Global Virtual Store and Expanded Version Catalogs
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
mantine-datatable-filter
Advanced tools
Column filter, sorting and pagination handler for mantine-datatable
a lightweight hook which help to handle mantine datatable filtering, column sorting and pagination.
npm install mantine-datatable-filter
import { DataTable } from 'mantine-datatable'
import useMantineDataTableFilter from 'mantine-datatable-filter'
const dtFilter = useMantineDataTableFilter({
sort: {
columnAccessor: 'id',
direction: 'desc',
},
pagination: {
totalRecords: totalRecords ?? 0,
sizes: [10, 15, 20],
},
columns: [
{
accessor: 'id',
type: 'number',
inputProps: {
label: 'ID',
placeholder: 'Search by ID',
}
},
{
accessor: 'name',
type: 'text',
inputProps: {
label: 'Name',
placeholder: 'Search by name',
}
}
],
onChange: (values, cleanedValues) => {
// handle change
},
debounced: 200
})
return <DataTable
// Add handler props here.
{...dtFilter.props}
columns={[
{
accessor: 'id',
title: 'ID',
sortable: true,
// Add filter props for each of columns.
...dtFilter.getFilterProps('id')
},
{
accessor: 'name',
title: 'Name',
sortable: true,
...dtFilter.getFilterProps('name')
}
]}
/>
Property | Type | Default Value | Description |
---|---|---|---|
accessor | string | Primary key for each column. | |
type | "text" | "number" | "date" | "datetime" | "select" | Column type. | |
post? | (value: "text" | "number" | "date" | "datetime" | "select") => "text" | "number" | "date" | "datetime" | "select" | () => {} | Post process function for a column. Note this will affect only for cleaned value. |
inputProps? | InputProps | {} | Props for filter input. Please refer to mantine documentations for input props. |
resetLabel? | string | "Reset" | Date type only. |
Property | Type | Default Value | Description |
---|---|---|---|
columnAccessor | string | Default sorting key. | |
direction | "asc" | "desc" | Direction of sorting. |
Property | Type | Default Value | Description |
---|---|---|---|
initialPage | number | 1 | Initial page. |
totalRecords | number | Total records. | |
sizes? | number | number[] | 10 | Total records per page. |
Property | Type | Default Value | Description |
---|---|---|---|
values | HandlerValues | Raw values. | |
cleanedValues | HandlerCleanedValues | Cleaned, with post data process and removed blank filters' values. |
Property | Type | Default Value | Description |
---|---|---|---|
debounced? | number | 0 | Debounced state for onChange when user input on filters. |
deps? | DependencyList | any[] | [] | Dependencies for triggering onChange. This is useful for adding extra features to the handler. |
Property | Type | Description |
---|---|---|
values | HandlerValues | Handler values. |
getFilterProps | (accessor: string) => FilterProps | Getter for generating filter option props for a column. |
refetch | () => void | Function for triggering onChange. |
props | DatatableProps | Sorting and pagination props for datatable. |
Property | Type | Description |
---|---|---|
sort | DataTableSortStatus | null | Column for sorting. |
filters | all of { key: FilterType } | Column filters values. |
pagination | { page: number; size: number } | Column pagination values. |
Property | Type | Description |
---|---|---|
accessor | string | Primary key for each column. |
type | "text" | "number" | "date" | "datetime" | "select" | Column type. |
value | (depends on type, refer to mantine documentation) | Column value. |
FAQs
Column filter, sorting and pagination handler for mantine-datatable
The npm package mantine-datatable-filter receives a total of 0 weekly downloads. As such, mantine-datatable-filter popularity was classified as not popular.
We found that mantine-datatable-filter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.