Skip to content

Commit

Permalink
fix(TableSelectAll): prevent selection of items that do not match fil…
Browse files Browse the repository at this point in the history
…ter (#7645)

* fix(TableSelectAll): prevent selection of items that do not match filter

* fix(TableBatchActions): use plural when selection equals 0

* chore(snapshot): update snapshots
  • Loading branch information
tw15egan authored Jan 28, 2021
1 parent 2e43971 commit b3b5a02
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/react/src/components/DataTable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ export default class DataTable extends React.Component {
})
: this.state.rowIds;
if (filteredRowIds.length == 0) {
return this.state.rowIds;
return [];
}
return filteredRowIds;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const TableBatchActions = ({
<div className={`${prefix}--batch-summary`}>
<p className={`${prefix}--batch-summary__para`}>
<span>
{totalSelected > 1
{totalSelected > 1 || totalSelected === 0
? t('carbon.table.batch.items.selected', { totalSelected })
: t('carbon.table.batch.item.selected', { totalSelected })}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ exports[`DataTable should render 1`] = `
className="bx--batch-summary__para"
>
<span>
0 item selected
0 items selected
</span>
</p>
</div>
Expand Down Expand Up @@ -3030,7 +3030,7 @@ exports[`DataTable sticky header should render 1`] = `
className="bx--batch-summary__para"
>
<span>
0 item selected
0 items selected
</span>
</p>
</div>
Expand Down

0 comments on commit b3b5a02

Please sign in to comment.