diff --git a/examples/customize-toolbarselect/CustomToolbarSelect.js b/examples/customize-toolbarselect/CustomToolbarSelect.js
index 9f53dbcfb..7e2d527d6 100644
--- a/examples/customize-toolbarselect/CustomToolbarSelect.js
+++ b/examples/customize-toolbarselect/CustomToolbarSelect.js
@@ -4,6 +4,7 @@ import Tooltip from "@mui/material/Tooltip";
import CompareArrowsIcon from "@mui/icons-material/CompareArrows";
import IndeterminateCheckBoxIcon from "@mui/icons-material/IndeterminateCheckBox";
import BlockIcon from "@mui/icons-material/Block";
+import DeleteIcon from '@mui/icons-material/Delete';
import { withStyles } from "tss-react/mui";
const defaultToolbarSelectStyles = {
@@ -38,6 +39,10 @@ class CustomToolbarSelect extends React.Component {
console.log(`block users with dataIndexes: ${this.props.selectedRows.data.map(row => row.dataIndex)}`);
};
+ handleDelete = () => {
+ this.props.onRowsDelete();
+ };
+
render() {
const { classes } = this.props;
@@ -58,6 +63,11 @@ class CustomToolbarSelect extends React.Component {
+
+
+
+
+
);
}
diff --git a/examples/customize-toolbarselect/index.js b/examples/customize-toolbarselect/index.js
index d803c3786..d8c333e69 100644
--- a/examples/customize-toolbarselect/index.js
+++ b/examples/customize-toolbarselect/index.js
@@ -55,8 +55,8 @@ function Example() {
responsive: "vertical",
rowsPerPage: 10,
selectToolbarPlacement: stp,
- customToolbarSelect: (selectedRows, displayData, setSelectedRows) => (
-
+ customToolbarSelect: (selectedRows, displayData, setSelectedRows, onRowsDelete) => (
+
),
};
diff --git a/src/components/TableToolbarSelect.js b/src/components/TableToolbarSelect.js
index ac7425936..b3995a260 100644
--- a/src/components/TableToolbarSelect.js
+++ b/src/components/TableToolbarSelect.js
@@ -75,7 +75,7 @@ class TableToolbarSelect extends React.Component {
{options.customToolbarSelect ? (
- options.customToolbarSelect(selectedRows, displayData, this.handleCustomSelectedRows)
+ options.customToolbarSelect(selectedRows, displayData, this.handleCustomSelectedRows, onRowsDelete)
) : (
diff --git a/test/MUIDataTableToolbarSelect.test.js b/test/MUIDataTableToolbarSelect.test.js
index ad69e5f5e..04958b051 100644
--- a/test/MUIDataTableToolbarSelect.test.js
+++ b/test/MUIDataTableToolbarSelect.test.js
@@ -23,7 +23,7 @@ describe('', function() {
assert.strictEqual(actualResult.length, 1);
});
- it('should call customToolbarSelect with 3 arguments', () => {
+ it('should call customToolbarSelect with 4 arguments', () => {
const onRowsDelete = () => {};
const customToolbarSelect = spy();
const selectedRows = { data: [1] };
@@ -38,7 +38,7 @@ describe('', function() {
/>,
);
- assert.strictEqual(customToolbarSelect.calledWith(selectedRows, displayData, match.typeOf('function')), true);
+ assert.strictEqual(customToolbarSelect.calledWith(selectedRows, displayData, match.typeOf('function'), match.typeOf('function')), true);
});
it('should throw TypeError if selectedRows is not an array of numbers', done => {