Loading a modal window is as follows:
getModalHtml(window.location.origin + '/workspace/show'); $('#modal-block').modal("show");
getModalHtml
- accepts url
, sends a request for it, and inserts received html
into a modal window. Also used bootstrap-select
:
<select class="selectpicker" data-live-search="true" data-size="5"> <option data-tokens="mustard">Burger, Shake and a Smile</option> <option data-tokens="frosting">Sugar, Spice and all things nice</option> </select>
When loading it did not work. After I added to bootstrap-select.js
:
$(document).on("shown.bs.modal", "#modal-block", function() { $('#modal-block .selectpicker').each(function() { var $selectpicker = $(this); Plugin.call($selectpicker, $selectpicker.data()); }) });
It works, but with a good delay, and sometimes it does not work at all.
Is there a universal solution to this problem? A similar problem occurs with other plugins.