Release 4.0.0-beta.0
Pre-releaseAdded
- 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
}}
/>
</>
),
}),