The modal insert dialog is hidden although onAddRow returns a string
See original GitHub issueAccording to handleSaveBtnClick in Toolbar.js a value/object that is returned by the function assigned to onAddRow in the BootstrapTable options should lead to a notice and the modal not being hidden. This does’t work. The reason is that handleAddRow in BootstrapTable.js does call onAddRow without returning the result. It should look like this:
handleAddRow = newObj => {
const { onAddRow } = this.props.options;
if (onAddRow) {
const colInfos = this.store.getColInfos();
// JB: Added returning the value that onAddRow returns, to pass it to the caller
const onAddRowResult = onAddRow(newObj, colInfos);
if (onAddRowResult) {
return onAddRowResult;
}
}
...
This ensures that a value/object returned by by the function assigned to onAddRow is passed to handleSaveBtnClick. The fix works in my copy of the BoostrapTable code in a production app without issues. We can even get rid ot the (not working) hack in ToolBar.handleSaveBtnClick:
handleSaveBtnClick = (newRow) => {
if (!this.validateNewRow(newRow)) { // validation fail
return;
}
const msg = this.props.onAddRow(newRow);
if (msg) {
notice('error', msg, '');
this.clearTimeout();
// shake form and hack prevent modal hide
this.setState({
shakeEditor: true
// JB: This (not working hack) obviously is not needed (anymore)
// , validateState: 'this is hack for prevent bootstrap modal hide
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Bootstrap modal hide is not working - Stack Overflow
I could not detect it in my local dev environment, but we're getting some reports saying that our modal isn't closing and the...
Read more >How to Use Tables (The Java™ Tutorials > Creating a GUI ...
The table in SimpleTableDemo.java declares the column names in a String array: String[] columnNames = {"First ... Add row to selection/toggle row selection....
Read more >3.1 - 3.7 - JavaScript in Dynaforms - ProcessMaker Wiki
When the user clicks on one of the buttons, the dialog box is hidden and the callback() function is executed which will add...
Read more ><Modal/> Component - React-Bootstrap
Add dialogs to your site for lightboxes, user notifications, or completely ... Use <Modal/> in combination with other components to show or hide...
Read more >Adding a new entry to a drop-down list when clicking its "Add ...
Inserting data into my database isn't a problem, but how do I get ... add dropdownlist item's content,you need to use dialog or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, it worked. Thank you so much
HI, if you call the callback with explicit string(error message), which means current operation fail so that
react-bootstrap-table
will not close the modal. But If there’s no any error, you can just call the callback without any arguments,react-bootstrap-table
will treat this operation as successful then close the modal.Let me know if you have any concern.