I have a bootstrap table containing data that needs to be edited, with certain fields not displayed in the table.
To enable editing, I have added an edit button to each row along with a modal form. The button successfully loads the modal form without any issues.
There are 3 questions I have:
- How can I load the modal form with the data corresponding to the row associated with the clicked button?
- What is the process for saving the edited data when the save button within the modal is clicked?
- How do I refresh the table after the modal closes upon clicking the save button?
While I believe a tutorial would be beneficial, I am unable to locate one at the moment.
The current code for the button is as follows:
<button type="button" class="btn btn-warning btn-xs" data-toggle="modal" data-target="#checkInModal">Check In</button>
Below is the current code snippet for the modal (with irrelevant fields removed for brevity):
<!-- Modal -->
<div class="modal fade" id="checkInModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Check In</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>