Adminlte: Sidebar treeview menu opened and reclosed automatically

Created on 27 Jun 2016  路  5Comments  路  Source: ColorlibHQ/AdminLTE

The issue was also reported in issue https://github.com/almasaeed2010/AdminLTE/issues/1053

The issue was fixed in PR https://github.com/almasaeed2010/AdminLTE/pull/729

However, I saw the (supposed unworking) code was reintroduced in 2.3.3 release.

I manually changed and the problematic behavior is corrected.

This is the exact duplicate of PR https://github.com/almasaeed2010/AdminLTE/pull/1001

bug

All 5 comments

A fix is being tested. Please see #1094

If the this doesn't fix it. Please let me know.

Thanks!

good afternoon
I have the latest version and still have the same problem, by clicking on the menu tree it opens and closes without reason

i have the same proble

Hi, I want to use this great repo, but with turbolinks for performances and I had the same problem as above.
After reading different issue raised in this repo, I finally found that:

  • if you apply what you can found here (issue 563) it attaches the listener twice because of double call of $.AdminLTE.pushMenu.activate() and $.AdminLTE.layout.activate() that ends on the result above. Then if you change view without refreshing the page, turbolinks make quicker application of assets and remove one of these listener that ends on the perfect result.
  • if you remove the if (options.sidebarPushMenu) so you solve the issue of when you refresh the page, but then on a turbolinks load, it removes this single event and don't apply the prevent default so the button become a simple link to the same page.

It seems the issue happen for all collapsable buttons.
So I wonder if we can still make this work (so close for making this work for good). @almasaeed2010 any idea?

I didn't read all the doc of turbolinks, but I adapt the code to make this work for both sidebars (control and main):

var lte_ready = function () {
  var options;
  options = $.AdminLTE.options;
  if ($.turboAlreadyLoaded) {
    if (options.sidebarPushMenu) {
      $.AdminLTE.pushMenu.activate(options.sidebarToggleSelector);
    }
    if (options.enableControlSidebar) {
      $.AdminLTE.controlSidebar.activate();
    }
  }
  $.turboAlreadyLoaded = true;
  return $.AdminLTE.layout.activate();
};
document.addEventListener('turbolinks:load', lte_ready);

Hope it helps

Was this page helpful?
0 / 5 - 0 ratings

Related issues

acacha picture acacha  路  4Comments

GuxMartin picture GuxMartin  路  3Comments

jrandhawa09 picture jrandhawa09  路  3Comments

andyhughes73 picture andyhughes73  路  3Comments

vbetancourt picture vbetancourt  路  3Comments