angular - angular-6-datatable 多选行
问题描述
我在我的角度项目中使用 angular-6-datatable 并使用 wnt 来选择多行。如何在“angular-6-datatable”上实现多行选择。过去 3-4 小时我一直在谷歌上搜索,但没有收到任何帖子。
解决方案
数据表在角度上被贬低了,现在新模块是p-table,放开链接,它将带你到文档。
https://www.primefaces.org/primeng-6.1.6/#/table/export
如果您只想通过数据表浏览,请关闭链接。
https://www.primefaces.org/primeng-6.1.6/#/datatable/export
下面的代码被说服选择要导出的行,您可以按照您需要的格式修改下面的代码。
<p-table #dt [columns]="cols" [value]="cars" selectionMode="multiple" [(selection)]="selectedCars">
<ng-template pTemplate="caption">
<div class="ui-helper-clearfix">
<button type="button" pButton icon="fa fa-file-o" iconPos="left" label="All Data" (click)="dt.exportCSV()" style="float:left"></button>
<button type="button" pButton icon="fa fa-file" iconPos="left" label="Selection Only" (click)="dt.exportCSV({selectionOnly:true})" style="float:right"></button>
</div>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns">
{{col.header}}
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr [pSelectableRow]="rowData">
<td *ngFor="let col of columns">
{{rowData[col.field]}}
</td>
</tr>
</ng-template>
</p-table>
推荐阅读
- android - 任务“:app:runCheckstyle”执行失败
- terraform - 是否可以使用 terraform 在 AWS 机密管理器中设置多用户机密轮换?
- python - 如何对作用于会话特定数据的 pytest 插件的钩子进行单元测试?
- php - 处理会话已经开始 & set_cookie_params
- windows - 环境变量无法正常工作
- mysql - MySQL全文按列得分
- php - 如何在php中获取上一页的URL
- performance - 时钟周期中的缓存未命中延迟
- bash - Bash 不断抛出“语法错误:文件意外结束”
- api - 我被卡住了,我无法使用 api Rest 将模型中的数据传递到另一个活动中