I'm having problems with the data-plugin switchery (Remark bootstrap component) that does not want to work in partialviews. The interesting thing is that if it stays inside a normal view, it works perfectly, but when placed inside a modal window (#modalGeneric) opened by a partialview, it does not work:
In a Normal view:
InaPartialView(Problem):
Code:
@modelRetaguarda.Application.ViewModels.ContatoTipo.ContatoTipoViewModel@{ViewData["Title"] = "_ContatoTipo";
}
<div class="panel">
<div class="panel-body container-fluid pt-10 pl-15 pr-15">
<div class="form-horizontal">
<vc:summary />
<div class="form-horizontal">
<div class="form-group row">
<div class="col-md-6">
<label asp-for="Descricao" class="control-label">Descrição</label>
<input asp-for="Descricao" class="form-control text-uppercase" />
<span asp-validation-for="Descricao" class="text-danger"></span>
</div>
</div>
<div class="example">
<div class="float-left mr-20">
<input type="checkbox" id="mycheckbox" name="inputiCheckBasicCheckboxes" data-plugin="switchery"
checked />
</div>
<label class="pt-3" for="inputBasicOn">On</label>
</div>
</div>
</div>
</div>
</div>
<script>
$('#mycheckbox').switchery({
switcheryParent: $('#modalGenerica')
});
</script>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
I tried to initialize it in the partialview, but it did not work. I do not know if there is even the switcheryParent property ...
<script>
$('#mycheckbox').switchery({
switcheryParent: $('#modalGenerica')
});
</script>
Does anyone know how to solve this problem? A hug to everyone and thank you!