0

I am using ngx-tadatable, when I click on the first row which is just the column indices it opens the modal as if I was clicking on a pretty one with the data. Does anyone know how I can stop this mode, making it open only in lines with data. Since this mode is only to be opened when I click on a data line to get it Follows the code.

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>

File 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)}`;
        });
    }

Vy Do
  • 46,709
  • 59
  • 215
  • 313
Betini O. Heleno
  • 326
  • 4
  • 15

1 Answers1

1

I think what you are wanting is a single how selection. Take a look at this one:

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

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

and use the select event instead of the click event (because click is at the whole table level).

Tim.Burnell
  • 346
  • 1
  • 9