Hi,
I have a problem with sidebar: I am applying Metronic theme 8.1.5 to existing MVC 5 application. After clicking on sidebar menu, application loads content but chosen menu does not stay visible and marked as chosen. I checked ASP.NET Core sample Starterkit and there is the same problem.
Global javascript bundle is applied in _layout.cshtml.
Thanks for your answer,
Regards, Valentin
Hi,
It was actually my fault - I was loading global js budle after the KTUtil call.
Your suggestion helped: after I changed the order of js loading, everything started to work just fine.
Thank you very much for your help!
Regards,Valentin
Hi Valentin,
Glad to hear that. All the best with your project!
Regards,
Lauris Stepanovs,
Keenthemes Support Team
Hi,
Thanks for your answer. I tried that and I'm getting this error:
Uncaught ReferenceError: KTUtil is not defined.
I'm working on a MVC application (not Core). Mandatory Global Javascript Bundle is loaded through Html.RenderPartial("_Scripts").
Is there anything else I should load?
Regards, Valentin
Hi Valentin,
Did you include js/scripts.bundle.js?
This file must be included above the code from the previous comment.
Regards,
Lauris Stepanovs,
Keenthemes Support Team
Hi Valentin,
Sorry for the late reply.
You can use KTMenu.updateByLinkAttribute
to activate a selected menu item, just set a correct href attribute for <a> tags in your menu.
When call updateByLinkAttribute
on every page load, use the current page route as a parameter for this function.
Here is an example:
<script>
KTUtil.onDOMContentLoaded(function() {
KTMenu.updateByLinkAttribute(window.location.pathname);
});
</script>