首页 > 解决方案 > 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();
      }

演示

标签: angulartypescript

解决方案


推荐阅读