mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
fix #567, add selectRow.hideSelectAll
This commit is contained in:
parent
2c68f22646
commit
8f028d9dd4
@ -146,6 +146,7 @@ BootstrapTable.propTypes = {
|
||||
mode: PropTypes.oneOf([Const.ROW_SELECT_SINGLE, Const.ROW_SELECT_MULTIPLE]).isRequired,
|
||||
clickToSelect: PropTypes.bool,
|
||||
clickToEdit: PropTypes.bool,
|
||||
hideSelectAll: PropTypes.bool,
|
||||
onSelect: PropTypes.func,
|
||||
onSelectAll: PropTypes.func,
|
||||
style: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
|
||||
|
||||
@ -27,6 +27,7 @@ export default class SelectionHeaderCell extends Component {
|
||||
mode: PropTypes.string.isRequired,
|
||||
checkedStatus: PropTypes.string,
|
||||
onAllRowsSelect: PropTypes.func,
|
||||
hideSelectAll: PropTypes.bool,
|
||||
selectionHeaderRenderer: PropTypes.func
|
||||
}
|
||||
|
||||
@ -63,7 +64,10 @@ export default class SelectionHeaderCell extends Component {
|
||||
CHECKBOX_STATUS_CHECKED, CHECKBOX_STATUS_INDETERMINATE, ROW_SELECT_MULTIPLE
|
||||
} = Const;
|
||||
|
||||
const { mode, checkedStatus, selectionHeaderRenderer } = this.props;
|
||||
const { mode, checkedStatus, selectionHeaderRenderer, hideSelectAll } = this.props;
|
||||
if (hideSelectAll) {
|
||||
return <th data-row-selection />;
|
||||
}
|
||||
|
||||
const checked = checkedStatus === CHECKBOX_STATUS_CHECKED;
|
||||
|
||||
|
||||
@ -104,6 +104,22 @@ describe('<SelectionHeaderCell />', () => {
|
||||
});
|
||||
|
||||
describe('render', () => {
|
||||
describe('when props.hideSelectAll is true', () => {
|
||||
beforeEach(() => {
|
||||
const checkedStatus = Const.CHECKBOX_STATUS_CHECKED;
|
||||
|
||||
wrapper = shallow(
|
||||
<SelectionHeaderCell mode="checkbox" checkedStatus={ checkedStatus } hideSelectAll />
|
||||
);
|
||||
});
|
||||
|
||||
it('should render empty th element', () => {
|
||||
expect(wrapper.find('th').length).toBe(1);
|
||||
expect(wrapper.find('th[data-row-selection]').length).toBe(1);
|
||||
expect(wrapper.find(CheckBox).length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when props.mode is radio', () => {
|
||||
beforeEach(() => {
|
||||
const checkedStatus = Const.CHECKBOX_STATUS_CHECKED;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user