In it I have a button which has a javascript ajax function which calls a controller action which returns a partial view and the model of a modal, which hosts a nop-select input. When the modal is launched for the first time everything works well. But when the modal is closed and opened for the second time, the nop-select element loses all styling, it previously had, so it's basically just the raw html multiselect...
Below is my View (where I start the modal shell):
<!-- Modal -->
<div class="modal fade" id="addAssignedBlocksModal" tabindex="-1" role="dialog" aria-labelledby="addAssignedBlocksModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<!-- Content will be loaded here -->
</div>
</div>
</div>
Below is my modal code:
@model DetailViewExtensionPopupModel
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">@T("Plugins.WeatherPriceChanger.DetailViewExtension.Modal.Title")</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<nop-select asp-for="SelectedBlockIds" asp-items="Model.AvailableBlocks" asp-multiple="true" />
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
<i class="fa fa-times"></i>
Cancel
</button>
<button type="button" class="btn btn-primary" id="saveAssignedBlocksButton" data-url='@Url.Action("SaveAssignedBlocks", "DetailView")'>
<i class="far fa-save"></i>
Save
</button>
</div>
</div>