我在ngx-datatable中使用行细节有两个问题 .

  • rowIndex不起作用 . 我发现了一个github问题描述了这个问题,但据说这个问题在v.10.0.2左右修复,而我正在使用11.1.5(当前版本) . 每行为{}返回0 . 我的解决方法是将自己的索引写入列然后引用它,但我不应该这样做 . 使用下面的代码,当我单击其中一行时,每一行都进入编辑模式,因为它们都具有相同的rowIndex .

  • 我可以't get the row-details rows to use the full-width of their ' parent ' rows. I suspect it' s因为我正在使用 [columnMode]="'flex'" 而演示使用columnMode] = "'force'" . 我可以设置一个最小宽度,但我可以't get width: 100% to work. Possibly because there'是一个没有宽度的div包装器

<ngx-datatable #dataTable class="material expandable" [rows]="rows" [limit]="50" [columnMode]="'flex'" [headerHeight]="50" [footerHeight]="50" [rowHeight]="50" [selectionType]="'single'" (select)="onSelect($event)" (activate)="onActivate($event)"> <!-- Row Detail Template --> <ngx-datatable-row-detail [rowHeight]="50" #myDetailRow (toggle)="onDetailToggle($event)"> <ng-template let-rowIndex="rowIndex" let-row="row" let-value="value" let-expanded="expanded" ngx-datatable-row-detail-template> <span class="rowDetail" title="Click to edit" (click)="editing[rowIndex + '-name'] = true" *ngIf="!editing[rowIndex + '-name']"> {{row.name}} </span> <mat-form-field floatPlaceholder='never' *ngIf="editing[rowIndex + '-name']"> <input matInput style="min-width:300px" (keyup.enter)="updateValue($event, 'name', rowIndex)" type="text" [value]="row.name" /> </mat-form-field> </ng-template> ...