Releases: neolution-ch/react-data-table
Release 5.2.0-beta.0
Added
rowSelection
feature
Changed
- the
wiki
documentation is now lined in the readme
Release 5.1.0
Fixed
- endless loop on
pagination
state when paginating client-side
Added
- auto
pageIndex reset
when paginating server side
Release 5.0.2-beta.1
Fixed
- endless loop on
pagination
state when paginating client-side
Added
- auto
pageIndex reset
when paginating server side
Release 5.0.2-beta.0
Fixed
- endless loop on
pagination
state when paginating client-side
Release 5.0.1
Fixed
sorting
andcolumnFilters
can be possibly undefined for notuseReactDataTable
hook
Release 5.0.0
Changed
- the
reset icon
will now reset the table to the initialState if provided, otherwise to the first value of the state - π₯ the
sorting
accepts now a strongly typed object instead of a list - π₯ the
columnFilters
can be used only defining afilter type
to datatable hooks
Removed
- π₯ utilities
getColumnFilterFromModel
andgetModelFromColumnFilter
are not exposed anymore
Release 4.2.0
Added
- option
dragAndDropOptions
to enable drag-and-drop rows via@dnd-kit
package.
Added
- option
cellClassName
added to the column meta to add class names to every cell of a column - option
headerClassName
added to the column meta to add class names to every header of a column - option
footerStyle
added to the column meta to add styles to every footer of a column - option
footerClassName
added to the column meta to add class names to every footer of a column
Release 4.1.0
Added
- option
hidePageSizeChange
added to hide the possibility to change the page size
Release 4.0.0
Added
- Skeletons for when the data is loading
Changed
-
π₯ Fundamentally changed how this package works. The state is now managed by the consumer of this package. This means that the consumer has to provide the data and the functions to update the data. The package only provides the UI components to display the data. This change was necessary to make the package more flexible and to allow the consumer to use the package in a wider range of use cases. Behind the scenes, the package uses the
useTable
hook from the@tanstack/react-table
package. The consumer can use theuseTable
hook directly if he wants to. TheReactDataTable
component is just a wrapper around theuseTable
hook. TheReactDataTable
component is still the recommended way to use this package. -
π₯ renamed
possiblePageItemCounts
topageSizes
. -
π₯
columns
is now of typeColumnDef<TData, TValue>
from the@tanstack/react-table
package. Please refer to the documentation of the@tanstack/react-table
package for more information: https://tanstack.com/table/v8/docs/api/core/table#columns (there are additional custom fields in the column.meta object defined by us:src/react-table.d.ts
)
Removed
- π₯ removed
rowHighlight
. UserowStyle
instead. - π₯ removed
enablePredefinedSort
prop. UseinitialState.sorting
instead. Orstate.sorting
if you want to manage the state yourself. - π₯ removed
predefinedFilter
prop. UseinitialState
. - π₯ removed
asc
prop. UseinitialState.sorting
instead. Orstate.sorting
if you want to manage the state yourself. - π₯ removed
predefinedItemsPerPage
prop. UseinitialState.pagination.pageSize
instead. Orstate.pagination.pageSize
if you want to manage the state yourself. - π₯ removed
orderBy
prop. UseinitialState.sorting
instead. Orstate.sorting
if you want to manage the state yourself. - π₯ removed
client
prop. Usedata
prop instead and manage the state of the data yourself. - π₯ removed
query
prop. Usedata
prop instead and manage the state of the data yourself. - π₯ removed
handlers
prop. Since the state is now managed by the user, the user is responsible for updating the data. - π₯ removed
actions
props. You can easily define whatever actions you would like to have in thecolumns
prop.
This is an example of how you could configure the actions column:
import { createColumnHelper } from "@tanstack/react-table";
const columnHelper = createColumnHelper<YourData>();
columnHelper.display({
id: "edit",
header: () => <span>Aktionen</span>,
cell: (props) => (
<>
<Link href={{ pathname: "/addresses/[addressId]", query: { addressId: props.row.getValue("addressId") } }}>
<FontAwesomeIcon icon={faEye} style={{ marginRight: "5px" }} />
</Link>
<FontAwesomeIcon
icon={faTrash}
style={{ marginRight: "5px" }}
onClick={async () => {
// do something
}}
/>
</>
),
}),
Release 4.0.0-beta.4
Added
- Skeletons for when the data is loading
Changed
-
π₯ Fundamentally changed how this package works. The state is now managed by the consumer of this package. This means that the consumer has to provide the data and the functions to update the data. The package only provides the UI components to display the data. This change was necessary to make the package more flexible and to allow the consumer to use the package in a wider range of use cases. Behind the scenes, the package uses the
useTable
hook from the@tanstack/react-table
package. The consumer can use theuseTable
hook directly if he wants to. TheReactDataTable
component is just a wrapper around theuseTable
hook. TheReactDataTable
component is still the recommended way to use this package. -
π₯ renamed
possiblePageItemCounts
topageSizes
. -
π₯
columns
is now of typeColumnDef<TData, TValue>
from the@tanstack/react-table
package. Please refer to the documentation of the@tanstack/react-table
package for more information: https://tanstack.com/table/v8/docs/api/core/table#columns
Removed
- π₯ removed
rowHighlight
. UserowStyle
instead. - π₯ removed
enablePredefinedSort
prop. UseinitialState.sorting
instead. Orstate.sorting
if you want to manage the state yourself. - π₯ removed
predefinedFilter
prop. Use `initialState. - π₯ removed
asc
prop. UseinitialState.sorting
instead. Orstate.sorting
if you want to manage the state yourself.
columnFiltersinstead. Or
state.columnFilters` if you want to manage the state yourself. - π₯ removed
predefinedItemsPerPage
prop. UseinitialState.pagination.pageSize
instead. Orstate.pagination.pageSize
if you want to manage the state yourself. - π₯ removed
orderBy
prop. UseinitialState.sorting
instead. Orstate.sorting
if you want to manage the state yourself. - π₯ removed
client
prop. Usedata
prop instead and manage the state of the data yourself. - π₯ removed
query
prop. Usedata
prop instead and manage the state of the data yourself. - π₯ removed
handlers
prop. Since the state is now managed by the user, the user is responsible for updating the data. - π₯ removed
actions
props. You can easily define whatever actions you would like to have in thecolumns
prop.
This is an example of how you could configure the actions column:
import { createColumnHelper } from "@tanstack/react-table";
const columnHelper = createColumnHelper<YourData>();
columnHelper.display({
id: "edit",
header: () => <span>Aktionen</span>,
cell: (props) => (
<>
<Link href={{ pathname: "/addresses/[addressId]", query: { addressId: props.row.getValue("addressId") } }}>
<FontAwesomeIcon icon={faEye} style={{ marginRight: "5px" }} />
</Link>
<FontAwesomeIcon
icon={faTrash}
style={{ marginRight: "5px" }}
onClick={async () => {
// do something
}}
/>
</>
),
}),