Skip to content
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

Dispose method does not work when loading data asyncronously #160

Open
marlonreid opened this issue Feb 20, 2018 · 1 comment
Open

Dispose method does not work when loading data asyncronously #160

marlonreid opened this issue Feb 20, 2018 · 1 comment

Comments

@marlonreid
Copy link

marlonreid commented Feb 20, 2018

Version: 2.7.1

I am using MetisMenu in an angular app, and ran into the problem described in #22 and #116 where metismenu no longer shows children when clicking on parents when loading data asynchronously.

I have tried the suggestion of first disposing the menu, loading the data and re-initialising the data but still child sections do not show when clicking on the parent. I have also tried different disposing, setting and re-initialising the menu but nothing works. It works well when the data is loaded synchronously

html

<div id="sidebar-collapse">
    <div class="admin-block d-flex">
    </div>
    <ul class="side-menu metismenu">
        <li *ngFor="let item of menuitems">
            <a href="javascript:;">
                <i class="sidebar-item-icon {{item.icon}}"></i>
                <span class="nav-label" (click)="onItemClick(item)">{{item.title}}</span>
                <i *ngIf="item.subItems.length" class="fa fa-angle-left arrow"></i>
            </a>
            <ul *ngFor="let subItem of item.subItems" class="nav-2-level collapse" routerLinkActive="in">
                <li>
                    <a routerLink="#" routerLinkActive="active" (click)="onItemClick(subItem)">{{subItem.title}}</a>
                </li>
            </ul>
        </li>
    </ul>
</div>

code that loads data async
Observable.fromPromise(this.getMenuData()) .subscribe((response) => { $(".metismenu").metisMenu('dispose'); this.menuitems = response $(".metismenu").metisMenu(); })

Please give a suggestion on how to get this working asynchronously.

@onokumus
Copy link
Owner

metisMenu does not support angular, react or vue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants