Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

Sidebar menu not marked as chosen


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


Text formatting options
Submit

Replies (5)


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


Your Support Matters!

We will highly appreciate your Metronic Review on Themeforest.
Please go to Themeforest Downloads page, select Metronic & leave your feedback.

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>


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Text formatting options
Submit