Skip to content

Commit

Permalink
fix #618
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Aug 13, 2016
1 parent 1df1dc2 commit f399e87
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ class BootstrapTable extends Component {
}

handleEditCell(newVal, rowIndex, colIndex) {
const { onCellEdit } = this.props.options;
const { beforeSaveCell, afterSaveCell } = this.props.cellEdit;
let fieldName;
React.Children.forEach(this.props.children, function(column, i) {
Expand All @@ -498,6 +499,17 @@ class BootstrapTable extends Component {
}
}

if (onCellEdit) {
onCellEdit(this.state.data[rowIndex], fieldName, newVal);
}

if (this.isRemoteDataSource()) {
if (afterSaveCell) {
afterSaveCell(this.state.data[rowIndex], fieldName, newVal);
}
return;
}

const result = this.store.edit(newVal, rowIndex, fieldName).get();
this.setState({
data: result
Expand Down Expand Up @@ -880,7 +892,6 @@ class BootstrapTable extends Component {
} else {
React.Children.forEach(this.props.children, (child, i) => {
if (child.props.width) {
console.log('yayay');
header.childNodes[i].style.width = `${child.props.width}px`;
header.childNodes[i].style.minWidth = `${child.props.width}px`;
}
Expand Down Expand Up @@ -993,6 +1004,7 @@ BootstrapTable.propTypes = {
onSearchChange: React.PropTypes.func,
onAddRow: React.PropTypes.func,
onExportToCSV: React.PropTypes.func,
onCellEdit: React.PropTypes.func,
noDataText: PropTypes.oneOfType([ PropTypes.string, PropTypes.object ]),
handleConfirmDeleteRow: PropTypes.func,
prePage: PropTypes.string,
Expand Down

0 comments on commit f399e87

Please sign in to comment.