我想用以下功能修改Reaction数据表扩展组件,但我无法修改它.
- 将自动筛选器更改为基于事件的筛选器,并将其设置为按钮onClick
- 将默认搜索图标更改为 bootstrap 按钮
- 使用导出和打印按钮(当前设置...数据到数据表扩展,按照文档,但它只显示数据表中的数据,但我不能使用打印和导出功能).
我目前使用的是RECTION 18
我try 将数据放入Reaction数据表组件中,当我这样做时,打印和导出功能工作得很好,但没有数据显示在数据表中.
我的代码如下:
import DataTable from "react-data-table-component";
import { tableCustomStyles } from "../../utils/CommonFunctions";
import DataTableExtensions from "react-data-table-component-extensions";
export default function UsersPage() {
const dataTableColumns = [
{
name: "#",
selector: (row, index) => `${index + 1}`,
sortable: false,
width: "50px",
},
{
name: "Last Name",
selector: (row) => row.lastName,
sortable: true,
width: "150px",
},
{
name: "First Name",
selector: (row) => row.firstName,
sortable: true,
width: "150px",
},
{
name: "Role(s)",
selector: (row) => row?.roles?.map((role) => role?.name).join(", "),
sortable: true,
width: "230px",
},
{
name: "Department(s)",
selector: (row) =>
row?.departments?.map((department) => department?.name).join(", "),
sortable: true,
width: "230px",
},
{
name: "Location(s)",
selector: (row) =>
row?.locations?.map((location) => location?.name).join(", "),
sortable: true,
width: "230px",
},
{
name: "Status",
selector: (row) => row?.status,
sortable: true,
width: "100px",
},
{
name: "Option(s)",
cell: (row) => (
<>
<Dropdown>
<Dropdown.Toggle variant='link' id='dropdown-basic'>
<VerticalDots style={{ height: 20 }} />
</Dropdown.Toggle>
<Dropdown.Menu>
<Dropdown.Item onClick={() => handleViewFullProfile(row)}>
View Full Profile
</Dropdown.Item>
<Dropdown.Item onClick={() => handleResetPassword(row)}>
Reset Password
</Dropdown.Item>
<Dropdown.Item onClick={() => handleUserStatus(row)}>
{row.status === "Active" ? "Deactivate" : "Activate"} User
</Dropdown.Item>
<Dropdown.Item onClick={() => handleOptionClick(row)}>
Other Option
</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
</>
),
ignoreRowClick: true,
allowOverflow: true,
button: true,
sortable: false,
width: "100px",
},
];
const tableData = {
columns: dataTableColumns,
data: users,
return (
<div>
<a
className='btn btn-primary'
to='/admin/administer/new-user'
onClick={handleNavigation}
>
+ Add User
</a>
<DataTableExtensions
{...tableData}
export={true}
print={true}
extensions={extensions}
>
<DataTable
// columns={dataTableColumns}
// data={users}
noHeader
defaultSortField='lastName'
defaultSortAsc={false}
customStyles={tableCustomStyles}
pagination
responsive='true'
highlightOnHover
/>
</DataTableExtensions>
</div>
)}