【发布时间】:2020-12-05 11:07:26
【问题描述】:
Angular Datatable >> 如何获取总行数和所有金额值的总和。需要获取表格的总行数。我尝试使用下表并仅获取第一页记录。请建议我如何get total number of records across all pages 并需要获得sum of the total records values。我试过下面的代码,
getTotalAmount(){
let amountValues="";
let rowCount = $("table > tbody").children().length;
console.log("rowCount ::: " + rowCount);
for(var i=0;i<rowCount;i++){
if(this.persons[i].firstName === 'Superman' && this.persons[i].index != '')
console.log(this.persons[i].index);
amountValues += parseFloat(this.persons[i].enteredDebit);
}
console.log("amountValues >>>>>>>" + amountValues);
}
【问题讨论】:
-
this.personas.length包含表中所有可能的行,因为您在 html 中循环此数组。对于价值观,你是什么意思?您获取的 json 返回 Id、Name 和 LastName 的数据集。 -
其实我的问题是,我只能访问显示页面记录,我无法访问所有页面。
-
我正在尝试获取“超人”的名字的所有金额值的总和(跨所有页面)
标签: javascript jquery angular datatables angular-datatables