AdminLTE icon indicating copy to clipboard operation
AdminLTE copied to clipboard

[BUG] When injecting sidebar into my pages, collapsible menu items stop working

Open Dazza666 opened this issue 6 years ago • 2 comments

Im not sure this is a bug, and perhaps im doing something incorrectly but hopefully someone will point me in the right direction.

I am quite new to this, but it seems insane that I would duplicate the sidebar and navbar on every single page, so instead I have created a div like so, in the body:

<div id="common-sidebar"></div>

And then, in my page I have

    window.onload = function () {

      // The sidebar
      $.get("sidebar.html", function (data) {
        $("#common-sidebar").html(data);
      });

    }

and, I get a common sidebar in the page. The links work etc, but if I try to collapse or expand the menu items nothing happens, like the click is ignored or not attached.

What am I doing wrong? What is the right way to do this?

Dazza666 avatar Aug 05 '20 17:08 Dazza666

You need to init the pushmenu & treeview plugin otherwise the sidebar will not collapse or the menu items will not open/close.

REJack avatar Sep 20 '20 09:09 REJack

You need to init the pushmenu & treeview plugin otherwise the sidebar will not collapse or the menu items will not open/close.

Using angularjs there is a way to init pushmenu and treview?

fabianocruzdf avatar Oct 08 '20 17:10 fabianocruzdf