Search code examples
angularangular5ngx-datatable

ngx-datatable very slow when load edit popup


I have ngx datatable like this,I can edit every row in poppup, all works fine until I got to second page of results, the is magic, when I click row to edit, I catch breakpoin in editCustomer method but data in popup are refreshed only after like 5 seconds, what I can check ?

    <ngx-datatable class="material colored-header sm table table-striped table-hover"
                   [loadingIndicator]="loadingIndicator"
                   [rows]="customers"
                   [rowHeight]="35"
                   [headerHeight]="35"
                   [footerHeight]="35"
                   [columns]="columns"
                   [scrollbarV]="true"
                   [rowClass]="getRowClass"
                   [columnMode]="'force'">
    </ngx-datatable>

    <ng-template #indexTemplate let-value="value">
        <strong>{{value}}</strong>
    </ng-template>

    <ng-template #actionsTemplate let-row="row" let-value="value" let-i="index">

        <a class="btn btn-link btn-xs" href="javascript:;" (click)="editCustomer(row)"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</a>

    </ng-template>


    <div class="modal fade" bsModal #editorModal="bs-modal" (onHidden)="onEditorModalHidden()" [config]="{backdrop: 'static'}" tabindex="-1">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title pull-left"><i class="fa fa-shield"></i> Customer Details </h4>

                    <button type="button" class="close pull-right" title="Close" (click)="editorModal.hide()">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <customer-editor #customerEditor></customer-editor>
                </div>
            </div>
        </div>
    </div>
</div>

in my ts file

 editCustomer(row: Customer) {
        this.customerEditor.editCustomer(row);
        this.editorModal.show();
    }

customerEditor is

@ViewChild('customerEditor')
customerEditor: CustomerEditorComponent;

and in customerEditor

editCustomer(customer: Customer) {
    if (customer) {

        this.customerEdit = new Customer();
        Object.assign(this.customerEdit, customer);

    }

and in customerEdit view is only {{customerEdit.name}} and, this is very strange but if go to second page in the table then popup refreshes data like after 4 -5 seconds.

Like changing pages in table would pause binding in angular for few seconds.


Solution

  • ok I found the problem, this is lib issue, problem fixed in latest version https://github.com/swimlane/ngx-datatable/issues/1321