Skip to content

Commit

Permalink
Select/Unselect all rows
Browse files Browse the repository at this point in the history
  • Loading branch information
soyjavi committed Nov 4, 2015
1 parent 0f9a38a commit 8894081
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/table/components/row.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Row extends React.Component {
if (this.props.onSelect) {
return (
<th className={style.selectable}>
<Checkbox onChange={this.handleSelectChange}/>
<Checkbox onChange={this.handleSelectChange} checked={this.props.selected}/>
</th>
)
}
Expand Down
10 changes: 5 additions & 5 deletions components/table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class Table extends React.Component {
};

state = {
dataSource: utils.cloneObject(this.props.dataSource)
dataSource: utils.cloneObject(this.props.dataSource),
selected: false
};

componentWillReceiveProps = (next_props) => {
Expand All @@ -32,7 +33,6 @@ class Table extends React.Component {
};

handleRowChange = (event, row, key, value) => {
console.log('handleRowChange', arguments);
let dataSource = this.state.dataSource;
dataSource[row.props.index][key] = value;
this.setState({ dataSource: dataSource });
Expand All @@ -47,8 +47,8 @@ class Table extends React.Component {
}
};

handleRowsSelect = (event) => {
console.info('handleRowsSelect', arguments);
handleRowsSelect = (event, selected) => {
this.setState({ selected: selected });
};

isChanged = (data, base) => {
Expand Down Expand Up @@ -86,7 +86,7 @@ class Table extends React.Component {
model={this.props.model}
onChange={this.props.onChange ? this.handleRowChange : null}
onSelect={this.props.onSelect ? this.handleRowSelect : null}
selected={false}
selected={this.state.selected}
/>
)
})
Expand Down

0 comments on commit 8894081

Please sign in to comment.