gpt4 book ai didi

javascript - “How to fix ‘NGX Data Table Checkbox Issue In Angular?”

转载 作者:行者123 更新时间:2023-12-03 21:03:31 24 4
gpt4 key购买 nike

我只是制作了通用 NGX 数据表以用于我的所有索引,但是每当我在表中使用复选框时,它总是出现在索引的最后一列。每当我单独应用它时,它出现在第一列但我不想使用它单独使用,因为它在每个索引中使用。

------------------------单 table ------------------------ ---

 <div class="row">
<ngx-datatable-footer>
<ng-template *ngIf="filerData.total>0" ngx-datatable-footer-template let-rowCount="filerData.total"
let-pageSize="pageSize" let-selectedCount="selectedCount" let-curPage="curPage"
let-offset="offset">
<div class="col-md-1 datatable-footer_pagination">
<select class="form-control" (change)="onPager($event.target.value,curPage)">
<option *ngFor="let option of pageLimitOptions" [value]="option.value"
[selected]="option.value == 15">
{{option.name}}
</option>
</select>
</div>
<datatable-pager class="mb-2" [pagerLeftArrowIcon]="'datatable-icon-left'"
[pagerRightArrowIcon]="'datatable-icon-right'" [pagerPreviousIcon]="'datatable-icon-prev'"
[pagerNextIcon]="'datatable-icon-skip'" [page]="curPage" [size]="pageSize"
[count]="filerData.total" (change)="onPager($event,curPage)">
</datatable-pager>
</ng-template>
<ng-template ngx-datatable-footer-template let-rowCount="filerData.total" let-pageSize="pageSize"
let-selectedCount="selectedCount" let-curPage="curPage" let-offset="offset">
<div class="col-md-4 datatable-footer_pagination"> No Data To Display
</div>
</ng-template>
</ngx-datatable-footer>
</div>
</ngx-datatable>

------------------------ 通用表------------------------ ---
<app-ws-table [rows]="rows" (onSort)="onSort($event)" [isCheckBox]="true" [columns]="columns"
[loading]="tableLoading" [rowCount]="filerData.total" [rowOffset]="filerData.current_page"
[rowLimit]="filerData.per_page" (onPager)='onPager($event)' (rowDelete)="onDeletion($event)"
(rowEdit)="onEdit($event)" [isClass]="true" [isLocal]="false" (selectedItem)="selectedClasses($event)"
(onDownload)="onFiles($event)">
</app-ws-table>

最佳答案

这对我有用。
在 html 中

<ngx-datatable [rows]="rows" 
[columns] = "[
{name:'select', cellTemplate: checkBox},
{name:'column one', prop:'one'},
{name:'column two', prop:'two'},
{name:'column three', prop : 'three'}
{name:'column four', prop: 'four'}]">
<ng-template #checkBox let-row="row" let-value="value">
<input type="checkbox">
</ng-template>
</ngx-datatable>
这会起作用。将您想要的数据分配给行。在 TS 中, this.rows = data

关于javascript - “How to fix ‘NGX Data Table Checkbox Issue In Angular?”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56123168/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com