加载编辑弹出窗口时,ngx-datatable非常慢

时间:2018-06-14 21:51:20

标签: angular angular5 ngx-datatable

我有这样的ngx datatable,我可以编辑poppup中的每一行,一切正常,直到我到第二页的结果,这是神奇的,当我点击行编辑时,我在editCustomer方法中捕获breakpoin但是数据在弹出窗口只在5秒后刷新,我可以检查一下吗?

    <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>

在我的ts文件中

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

customerEditor是

@ViewChild('customerEditor')
customerEditor: CustomerEditorComponent;

并在customerEditor

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

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

    }

并且在customerEdit视图中只有{{customerEdit.name}} 并且,这是非常奇怪的,但是如果转到表格的第二页,那么popup会刷新数据,比如4-5秒后。

就像更改表格中的页面一样,会暂停角度几秒钟的绑定。

1 个答案:

答案 0 :(得分:0)

好的我发现了问题,这是lib问题,最新版本修复了问题 https://github.com/swimlane/ngx-datatable/issues/1321

相关问题