Próbuję wykorzystać react-bootstrap-table zeby zroibć tabelkę z możliwością wstawiania elementów
jak w przykładzie
http://allenfang.github.io/react-bootstrap-table/example.html#manipulation
Skopiowałem kod, przy wciśnięciu w "new", ma wyskoczyć okienko, a jest:
Error: react-modal: You must set an element with Modal.setAppElement(el)
to make this accessible
Co jest powodem i jak to poprawić?
W załączniku całość,
Poniżej kod skryptu jsx:
const products = [{id:1,name:'cośtam',price:2}];
function onAfterInsertRow(row) {
let newRowStr = '';
for (const prop in row) {
newRowStr += prop + ': ' + row[prop] + ' \n';
}
alert('The new row is:\n ' + newRowStr);
}
const options = {
afterInsertRow: onAfterInsertRow // A hook for after insert rows
};
class InsertRowTable extends React.Component {
//componentWillMount() {
// ReactModal.setAppElement('body');
//}
render() {
return (
<BootstrapTable data={ products } insertRow={ true } options={ options }>
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn>
<TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn>
</BootstrapTable>
);
}
}
ReactDOM.render(<InsertRowTable />, document.getElementById('root'));