Skip to content

Commit

Permalink
fix(DataTable): ignore disabled rows on table select all (#5840)
Browse files Browse the repository at this point in the history
  • Loading branch information
emyarod authored and joshblack committed Apr 16, 2020
1 parent f7bf5b5 commit c2d6751
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/react/src/components/DataTable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export default class DataTable extends React.Component {
getSelectedRows = () =>
this.state.rowIds.filter(id => {
const row = this.state.rowsById[id];
return row.isSelected;
return row.isSelected && !row.disabled;
});

/**
Expand Down Expand Up @@ -439,10 +439,9 @@ export default class DataTable extends React.Component {
...acc,
[id]: {
...initialState.rowsById[id],
isSelected:
!initialState.rowsById[id].disabled &&
filteredRowIds.includes(id) &&
isSelected,
...(!initialState.rowsById[id].disabled && {
isSelected: filteredRowIds.includes(id) && isSelected,
}),
},
}),
{}
Expand Down Expand Up @@ -471,7 +470,8 @@ export default class DataTable extends React.Component {
const filteredRowIds = this.getFilteredRowIds();
const { rowsById } = state;
const isSelected = !(
Object.values(rowsById).filter(row => row.isSelected == true).length > 0
Object.values(rowsById).filter(row => row.isSelected && !row.disabled)
.length > 0
);
return {
shouldShowBatchActions: isSelected,
Expand Down

0 comments on commit c2d6751

Please sign in to comment.