angular - Angular DataTable:如何仅选择当前页面记录
问题描述
有角度数据表,如果我们选中全选复选框,则需要选择当前页面上的所有记录并动态获取帐户列值的总和,如果我们移动到第二页并全选,则第一页记录以及第二页记录。在所有页面中选择的代码下方,
checkuncheckall() {
let chkBoxlength = $(".checkboxCls:checked").length;
const totalChecked = this.persons.filter(f => f.checked).length;
const target = totalChecked !== this.persons.length;
this.persons.forEach(f => (f.checked = target));
this.cdRef.detectChanges();
}
解决方案
推荐阅读
- x86 - x86 程序集中的 ds:0x402000 和 DWORD PTR ds:0x402000 有什么区别?
- android - AAssetManager 无法从共享库访问原始资源
- xpath - 使用 com.jcabi.jcabi-xml 时,“前缀必须解析为命名空间:p”
- opencv - How to make image source change after handle without display another one on canvas output (OpenCV.js)
- python - 无论我放什么图像,我的 CNN 模型都只预测第一类
- c++ - 加快 g++ 编译时间
- javascript - d3.js 强制有向图不起作用
- java - 计算一个数字与自身相加多少次,直到达到任意值?
- django - Django 测试数据库需要启用 Postgres 扩展
- javascript - 如何在一个 npm 包中公开多个文件?