Last active
October 12, 2015 14:08
-
-
Save reactormade/4038377 to your computer and use it in GitHub Desktop.
Twitter Bootstrap multiple remote modals on same page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anchor(base_url().'sample/'.$object->hash,'<span class="btn btn-mini btn-info"><i class="icon-search icon-white"></i> View</span>',array('data-remote'=>base_url().'sample/'.$object->hash,'data-toggle'=>'modal','data-target'=>'#modal-sample')); | |
$('#modal-sample').on('hidden', function() { | |
$(this).removeData('modal'); | |
}); | |
<div class="modal hide fade" id="modal-sample" tabindex="-1"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal">×</button> | |
<h3>Sample</h3> | |
</div> | |
<div class="modal-body"> | |
</div> | |
<div class="modal-footer"> | |
<button class="btn" data-dismiss="modal">Close</button> | |
</div> | |
</div> |
"Second, the Modal plugin is designed to load the remote resource in the constructor of the Modal object, which unfortunately means that even if a change is made to the options.remote, it will never be reloaded.
A simple remedy is to destroy the Modal object before subsequent toggles. One option is to just destroy it after it finishes hiding"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/questions/12286332/twitter-bootstrap-remote-modal-shows-same-content-everytime