[英]how to sum each specific rendered row horizontally on jquery datatable
我从 sql 查询中获取 datasrc 的数据,并使用
"data": "attribute", "name": "name",
"render": function (data, type, full, meta) {}
我无法从 sql 查询中获取计算值,我必须将特定行的每个渲染值求和并将结果水平放置在每列中,例如每行的波纹管:第 1 行 col1 + 第 1 行 col2 + 第 1 行 col3 并放入 te导致第 1 行 col4
和所有水平线一样。
Rows Col1 Col2 Col3 Col4 col5 col6 col7
1 12 1 23 36 string string string
2 1 0 5 6 string
3 6 2 9 16 string
对于这个jquery数据表服务器端显示1-10:
"autoWidth": true,
"processing": true,
"serverSide": true,
"ajax": {
'type': 'POST',
'url':
'dataSrc':function (json) {
return json.data;
},
'complete': function (response) {
}
},
"columns": [
{"data": "id"},
{"data": "attribute", "name": "name",
"render": function (data, type, full, meta) {}
}
---
---
考虑以下代码段。
"columns": [{
"data": "id"
},
{
"data": "attribute",
"name": "name",
"render": function(data, type, row, meta) {
return (row[1] + row[2] + row[3]);
},
"targets": 4
}]
查看更多: https ://datatables.net/reference/option/columns.render
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.