diff --git a/src/BootstrapTable.js b/src/BootstrapTable.js
index 174298415..52fd92891 100644
--- a/src/BootstrapTable.js
+++ b/src/BootstrapTable.js
@@ -227,9 +227,9 @@ class BootstrapTable extends React.Component {
var defaultSelectRowKeys = this.store.getSelectedRowKeys();
var allRowKeys = this.store.getAllRowkey();
if(defaultSelectRowKeys.length !== allRowKeys.length){
- return false;
+ return defaultSelectRowKeys.length === 0 ? false : 'indeterminate';
} else {
- return defaultSelectRowKeys.every(elm => allRowKeys.indexOf(elm)>-1);
+ return true;
}
}
diff --git a/src/TableHeader.js b/src/TableHeader.js
index f72bc3609..ccc46cbcc 100644
--- a/src/TableHeader.js
+++ b/src/TableHeader.js
@@ -1,9 +1,22 @@
import React from 'react';
+import ReactDOM from 'react-dom';
import Const from './Const';
import Util from './util';
import classSet from 'classnames';
import SelectRowHeaderColumn from './SelectRowHeaderColumn';
+class Checkbox extends React.Component{
+ componentDidMount() { this.update(this.props.checked); }
+ componentWillReceiveProps(props) { this.update(props.checked); }
+ update(checked) {
+ ReactDOM.findDOMNode(this).indeterminate = checked === 'indeterminate';
+ }
+
+ render() {
+ return
+ }
+}
+
class TableHeader extends React.Component{
constructor(props) {
@@ -65,7 +78,7 @@ class TableHeader extends React.Component{
return ();
}else if(this.props.rowSelectType == Const.ROW_SELECT_MULTI){
return (
-
+
);
}else{
@@ -113,7 +126,7 @@ TableHeader.propTypes = {
hideSelectColumn: React.PropTypes.bool,
bordered: React.PropTypes.bool,
condensed: React.PropTypes.bool,
- isSelectAll: React.PropTypes.bool
+ isSelectAll: React.PropTypes.oneOf([true, 'indeterminate', false])
};
TableHeader.defaultProps = {