diff --git a/demo/demo.js b/demo/demo.js index 251597efe..386240b5e 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -81,41 +81,41 @@ class App extends Component { title="Demo Title" editable={{ onRowAdd: newData => - new Promise((resolve, reject) => { - setTimeout(() => { - { - /* const data = this.state.data; - data.push(newData); - this.setState({ data }, () => resolve()); */ - } - resolve(); - }, 1000); - }), + new Promise((resolve, reject) => { + setTimeout(() => { + { + /* const data = this.state.data; + data.push(newData); + this.setState({ data }, () => resolve()); */ + } + resolve(); + }, 1000); + }), onRowUpdate: (newData, oldData) => - new Promise((resolve, reject) => { - setTimeout(() => { - { - /* const data = this.state.data; - const index = data.indexOf(oldData); - data[index] = newData; - this.setState({ data }, () => resolve()); */ - } - resolve(); - }, 1000); - }), + new Promise((resolve, reject) => { + setTimeout(() => { + { + /* const data = this.state.data; + const index = data.indexOf(oldData); + data[index] = newData; + this.setState({ data }, () => resolve()); */ + } + resolve(); + }, 1000); + }), onRowDelete: oldData => - new Promise((resolve, reject) => { - setTimeout(() => { - { - /* let data = this.state.data; - const index = data.indexOf(oldData); - data.splice(index, 1); - this.setState({ data }, () => resolve()); */ - } - resolve(); - }, 1000); - }) - }} + new Promise((resolve, reject) => { + setTimeout(() => { + { + /* let data = this.state.data; + const index = data.indexOf(oldData); + data.splice(index, 1); + this.setState({ data }, () => resolve()); */ + } + resolve(); + }, 1000); + }) + }} /> diff --git a/src/components/m-table-action.js b/src/components/m-table-action.js index 0c98a4639..9ffb287c7 100644 --- a/src/components/m-table-action.js +++ b/src/components/m-table-action.js @@ -16,6 +16,13 @@ class MTableAction extends React.Component { return null; } } + + if (action.action) { + action = action.action(this.props.data); + if (!action) { + return null; + } + } if (action.hidden) { return null;