具有模式Angular 8的ngx-datatable

时间:2019-11-26 02:13:04

标签: angular modal-dialog angular8 ngx-datatable

我正在使用ngx-tadatable,当我单击仅是列索引的第一行时,它会打开模式,就好像我单击的是带有数据的漂亮模式一样。有谁知道我如何才能停止此模式,使其仅在数据行中打开。由于仅当我单击数据行以获取此模式时才打开此模式 遵循代码。

enter image description here

macroarea.modal.html

    <div class="row">
        <div class="col-sm-12">
            <div class="card">
                <div class="card-header">
                    <h5>{{ title }}</h5>
                </div>
                <div class="card-body custom-datatable">
                    <ngx-datatable class="bootstrap pointer" [rows]="macroarea" [loadingIndicator]="loadingIndicator"
                        [columns]="columns" [columnMode]="'force'" [headerHeight]="40" 
                        [summaryPosition]="'bottom'" [footerHeight]="40" [rowHeight]="'auto'"
                        [reorderable]="reorderable" [limit]="10" (click)="open(mymodal, $event)"
                        (activate)="onLoadMacroaresDatas($event)">
                    </ngx-datatable>
                </div>
            </div>
        </div>
    </div>

文件macroarea.component.ts

    open(content, event) {
        this.modalService.open(content, this.modalOptions).result.then((result) => {
            this.closeResult = `Closed with: ${result}`;
            this.macroName = null;
            this.modalReference = result;
        }, (reason) => {
            this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
        });
    }

1 个答案:

答案 0 :(得分:1)

我认为您想要的只是一个如何选择。看看这个:

http://swimlane.github.io/ngx-datatable/#single-selection

https://github.com/swimlane/ngx-datatable/blob/master/src/app/selection/selection-single.component.ts

并使用select事件而不是click事件(因为click在整个表级别)。