I'm using dynatable.js http://www.dynatable.com/ and bootstrap3 modal to show a map when a link inside a sortable table is clicked.
I'm looking for some help with a problem this issue. When I first load the page and I click the Location link, the modal and remote data shows and works fine, it loads a map of the location properly. However, If I load the page and then click one of the columns to sort the table (lets say for example I click the item# column to sort by item number) and then click the location link, the modal shows with the loading text but the [data-load-remote].on('click') does not trigger at all. I'm not getting any errors or console message when this happens either.
It only happens if I sort the column. If I load the page and don't click sorting a column everything works fine.
Table
<table id="inventory-table" class="table">
<thead>
<tr>
<th>Item #</th>
<th class="hidden-xs">Location</th>
</tr>
</thead>
<tbody>
<tr>
<td>1234</td>
<td><a href="#myModal" role="button" data-toggle="modal" data-load-remote="/item-location/4" data-remote-target="#myModal . modal-body">555 W. Test St.</a></td>
</tr>
</tbody>
</table>
Bootstrap Modal
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body bg-gray-lighter">
<p>Loading...</p>
</div>
</div>
</div>
Javascript
<script type="text/javascript">
$( document ).ready(function() {
$('#inventory-table').dynatable({
dataset: {
perPageDefault: 20,
perPageOptions: [20, 30, 50, 100]
}
});
$('[data-load-remote]').on('click',function(e) {
e.preventDefault();
var $this = $(this);
var remote = $this.data('load-remote');
if(remote) {
$($this.data('remote-target')).load(remote);
}
$(".modal-body").html('<p>Loading...</p>');
});
$('#dynatable-query-search-inventory-table').addClass('form-control');
$('#dynatable-per-page-inventory-table').addClass('form-control selectperpage');</script>