ant-design-pro
, the toggleEditable
function triggered by clicking in the advanced form TableForm.js
, how to add editable: true
to newData. Please explain const newData = data.map (item = > ({.item}));
toggleEditable = (e, key) => {
e.preventDefault();
const { data } = this.state;
const newData = data.map(item => ({ ...item }));
const target = this.getRowByKey(key, newData);
if (target) {
//
if (!target.editable) {
this.cacheOriginData[key] = { ...target };
}
target.editable = !target.editable;
this.setState({ data: newData });
}
};