diff --git a/components/table/components/head.jsx b/components/table/components/head.jsx
index eccbbe7c..31694978 100644
--- a/components/table/components/head.jsx
+++ b/components/table/components/head.jsx
@@ -7,23 +7,25 @@ class Head extends React.Component {
static propTypes = {
className: React.PropTypes.string,
model: React.PropTypes.object,
- onSelect: React.PropTypes.func
+ onSelect: React.PropTypes.func,
+ selected: React.PropTypes.bool
};
static defaultProps = {
className: '',
- model: {}
+ model: {},
+ selected: false
};
- handleSelectChange = (event, instance) => {
- this.props.onSelect(event, instance.getValue());
+ handleSelectChange = (event) => {
+ this.props.onSelect(event);
};
renderCellSelectable () {
if (this.props.onSelect) {
return (
-
+
|
);
}
diff --git a/components/table/components/row.jsx b/components/table/components/row.jsx
index 2b4fd428..cb44e555 100644
--- a/components/table/components/row.jsx
+++ b/components/table/components/row.jsx
@@ -43,8 +43,8 @@ class Row extends React.Component {
this.props.onChange(event, this, key, event.target.value);
};
- handleSelectChange = (event, instance) => {
- this.props.onSelect(event, instance.getValue(), this);
+ handleSelectChange = (event) => {
+ this.props.onSelect(event, this);
};
renderCell (key) {
diff --git a/components/table/index.jsx b/components/table/index.jsx
index 51d5f32a..8e4012e4 100644
--- a/components/table/index.jsx
+++ b/components/table/index.jsx
@@ -42,10 +42,11 @@ class Table extends React.Component {
}
};
- handleRowSelect = (event, selected, instance) => {
+ handleRowSelect = (event, instance) => {
if (this.props.onSelect) {
- const selected_rows = this.state.selected_rows;
const index = instance.props.index;
+ const selected_rows = this.state.selected_rows;
+ const selected = selected_rows.indexOf(index) === -1;
if (selected) {
selected_rows.push(index);
this.props.onSelect(event, instance.props.data);
@@ -56,8 +57,8 @@ class Table extends React.Component {
}
};
- handleRowsSelect = (event, selected) => {
- this.setState({ selected: selected });
+ handleRowsSelect = (event) => {
+ this.setState({ selected: !this.state.selected });
};
isChanged = (data, base) => {
@@ -76,6 +77,7 @@ class Table extends React.Component {