Base solution for your next web application
Open Closed

PrimeNg Lazy Load in angular modal #4301


User avatar
0
cangunaydin created

Hello, I was wondering if there is an example how to use primeng datatable with lazy loading inside modal with sorting and paging. If i use the users component example:

getUsers(event?: LazyLoadEvent) {
        if (this.primengDatatableHelper.shouldResetPaging(event)) {
            this.paginator.changePage(0);

            return;
        }

        this.primengDatatableHelper.showLoadingIndicator();

        this._userServiceProxy.getUsers(
            this.filterText,
            this.permission ? this.selectedPermission : undefined,
            this.role,
            this.primengDatatableHelper.getSorting(this.dataTable),
            this.primengDatatableHelper.getMaxResultCount(this.paginator, event),
            this.primengDatatableHelper.getSkipCount(this.paginator, event)
        ).subscribe(result => {
            this.primengDatatableHelper.totalRecordsCount = result.totalCount;
            this.primengDatatableHelper.records = result.items;
            this.primengDatatableHelper.hideLoadingIndicator();
        });
    }

this.dataTable will be undefined in modal since it is not displayed and loaded, so how can i fix it to use lazy loading inside the angular modal?

Thank you for the assistance.


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @cangunaydin,

    The datatable in "add-member-modal.component.html" might be the correct example for you. You can find it under src>app>admin>organization-unit folder.

    You can see the modal when adding a member to an organization unit on the angular ui.