Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

PrimeNG datatable issue with dropdown column #4704


User avatar
0
mmukkara created

Hi All, I am having a issue with dropdown embedded in PrimeNG datatable. When I launch new page from one of the Action in dropdown...the drop down is carried to next screen (non model form) and doesn't go away until I refresh the page. See Screenshots..

<p-column field=""
                                      header="{{l('Actions')}}"
                                      [sortable]="false"
                                      [style]="{'width':'130px','text-align':'center'}"
                                      [hidden]="!isGrantedAny('Pages.Tenant.SomeSecurity')">
                                <ng-template let-record="rowData" pTemplate="body">
                                    <div class="btn-group dropdown" normalizePosition>
                                        <button class="dropdown-toggle btn btn-sm btn-primary"
                                                data-toggle="dropdown"
                                                aria-haspopup="true"
                                                aria-expanded="false">
                                            <i class="fa fa-cog"></i><span class="caret"></span> {{l("Actions")}}
                                        </button>
                                        <ul class="dropdown-menu">
                                            <li>
                                                <a *ngIf="permission.isGranted('Pages.Tenant.SomeSecurity')"
                                                   (click)="onView(record.id)">{{l('Edit')}}</a>
                                            </li>
                                            <li>
                                                <a *ngIf="permission.isGranted('Pages.Tenant.SomeSecurity')"
                                                   (click)="onView(record.id)">{{l('Activate')}}</a>
                                            </li>
                                            <li>
                                                <a *ngIf="permission.isGranted('Pages.Tenant.SomeSecurity')"
                                                   (click)="onView(record.id)">{{l('Discard')}}</a>
                                            </li>
                                        </ul>
                                    </div>
                                </ng-template>
                            </p-column>

[attachment=1:2oa8k11n]ActionPic1.PNG[/attachment:2oa8k11n]

[attachment=0:2oa8k11n]ActionPic2.PNG[/attachment:2oa8k11n]

when I go back, the dropdown stays in the screen and when click on another Action it opens another one. I don't see any page errors in chrome console. Am I missing something?

Appreciate your quick reply. Thank you!


2 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    It might be that some other library's CSS interferes with this one. Can you check the current pop-up's assigned CSS properties with the original ones in AspNet Zero Demo website

  • User Avatar
    0
    mmukkara created

    this issue has been fixed by adding below code to main-routing.module.ts (Just copied from admin-routing.module.ts)

    constructor(private router: Router) {
            router.events.subscribe(() => {
                this.hideOpenDataTableDropdownMenus();
            });
        }
    
        hideOpenDataTableDropdownMenus(): void {
            let $dropdownMenus = $('.dropdown-menu.tether-element');
            $dropdownMenus.css({
                'display': 'none'
            });
        }
    

    Thanks