-
Notifications
You must be signed in to change notification settings - Fork 725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Left panel menu items maximises and minimises on page reload and menu selection #1347
Comments
how about this issue? i undergo a same question. |
Resolved this issue by writing a decorator for directive maMenubar (https://github.com/marmelab/ng-admin/blob/master/src/javascripts/ng-admin/Main/component/directive/maMenuBar.js) If you observe in maMenubar.js, whenever "locationChangeSuccess" event is fired render() is invoked which causes the whole left menu to be redrawn again. That causes the flicker.
` scope.activateLink = function (menu, parentMenu) {
<div class="navbar-default sidebar" role="navigation" compile="menu.template()">
<div class="sidebar-nav navbar-collapse collapse" uib-collapse="$parent.isCollapsed">
<ul class="nav" id="side-menu">
<li class="entities-repeat" ng-repeat="(key, firstLevelMenu) in ::menu.children()" data-menu-id="{{ ::firstLevelMenu.uuid }}" compile="firstLevelMenu.template()">
<a ng-if="::firstLevelMenu.hasChild()" ng-click="toggleMenu(firstLevelMenu)" ng-class="::{'active': firstLevelMenu.isActive(path)}">
<span compile="::firstLevelMenu.icon()"><span class="glyphicon glyphicon-list"></span></span>
{{ firstLevelMenu.title() | translate }}
<span class="glyphicon arrow" ng-class="::{'glyphicon-menu-down': isOpen(firstLevelMenu), 'glyphicon-menu-right': !isOpen(firstLevelMenu) }"></span>
</a>
<a ng-if="::!firstLevelMenu.hasChild()" href="#{{ firstLevelMenu.link() }}" ng-click="activateLink(firstLevelMenu)" ng-class="::{'active': firstLevelMenu.isActive(path)}">
<span compile="::firstLevelMenu.icon()"><span class="glyphicon glyphicon-list"></span></span>
{{ firstLevelMenu.title() | translate }}
</a>
<ul ng-if="::firstLevelMenu.hasChild()" class="nav nav-second-level collapsible" data-menu-id="{{ ::firstLevelMenu.uuid }}" ng-class="::{'collapsed': !isOpen(firstLevelMenu) }">
<li ng-repeat="secondLevelMenu in ::firstLevelMenu.children()" data-menu-id="{{ ::secondLevelMenu.uuid }}" compile="secondLevelMenu.template()">
<a href="#{{secondLevelMenu.link()}}" ng-click="activateLink(secondLevelMenu, firstLevelMenu)" ng-class="::{'active': secondLevelMenu.isActive(path)}">
<span compile="::secondLevelMenu.icon()"><span class="glyphicon glyphicon-list"></span></span>
{{ secondLevelMenu.title() | translate }}
</a>
</li>
</ul>
</li>
</ul>
</div>
</div> If you use any comparator , you will observe the only difference between menubar.html ( https://github.com/marmelab/ng-admin/blob/master/src/javascripts/ng-admin/Main/view/menuBar.html) and the customizedMenubar.html is
And some renaming of iterator variables in ng-repeat from menu to firstLevelMenu and SecondLevelMenu. Note: The above solution will not highlight the relevant menu item when a user changes the address bar to point to some other menu item. To fix that change locationChangeSuccess listener to make it capable to get activeMenu item either based on address bar of browser or from scope.activateLink(this was already done above ) ` var listener = $rootScope.$on('$locationChangeSuccess', function() {
` Thanks for coming this far and reading it :) |
Any fix for this issue? |
Easiest workaround for this issue not to reproduce is setting autoClose(false) like below
Assuming master holds all the other submenu objects |
But what if I want to use auto close option. I used your previous solution in ng-admin source, it worked. but I wanted to know if there was plan to solve this issue in the original ng-admin repository. |
Above solutions don't work for me. Found out my solution for this, add this css
|
Left panel menu minimises and maximises always for a fraction of second every time when page is refreshed or any menu item is selected
plunkr : http://plnkr.co/edit/yTMTofsjfw4XT4EOzint?p=preview
Note: To see issue occuring (especially page refresh case) download the zip from plunkr and run the index.html page individually
GIF :
Expected behavior: Only already opened menu item should remain open with no flickering
Actual behavior: 8/10 times flicker happens, gets worse when the menu list is lengthy
The text was updated successfully, but these errors were encountered: