Skip to content

Commit

Permalink
allow to disable bulk edit via isBulkEditable func (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
IniterWorker authored Apr 13, 2022
1 parent 66c1ca4 commit a28088b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/material-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ export default class MaterialTable extends React.Component {
tooltip: localization.bulkEditTooltip,
position: 'toolbar',
hidden: this.dataManager.bulkEditOpen,
disabled:
calculatedProps.isBulkEditable && calculatedProps.isBulkEditable(),
onClick: () => {
this.dataManager.changeBulkEditOpen(true);
this.props.onBulkEditOpen && this.props.onBulkEditOpen(true);
Expand Down
1 change: 1 addition & 0 deletions src/prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export const propTypes = {
]).isRequired,
editable: PropTypes.shape({
isEditable: PropTypes.func,
isBulkEditable: PropTypes.func,
isDeletable: PropTypes.func,
onRowAdd: PropTypes.func,
onRowUpdate: PropTypes.func,
Expand Down
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface MaterialTableProps<RowData extends object> {
| (DetailPanel<RowData> | ((rowData: RowData) => DetailPanel<RowData>))[];
editable?: {
isEditable?: (rowData: RowData) => boolean;
isBulkEditable?: () => boolean;
isDeletable?: (rowData: RowData) => boolean;
onBulkUpdate?: (
changes: Record<number, { oldData: RowData; newData: RowData }>
Expand Down

0 comments on commit a28088b

Please sign in to comment.