I get data for datasrc from sql query and I display for each column using
"data": "attribute", "name": "name",
"render": function (data, type, full, meta) {}
I can't get calculate value from sql query, I have to get each rendred value of specific row to sum and put the result in each column horizontally exemple bellow of eachrow : row 1 col1 + row 1 col2 + row 1 col3 and put te result in row 1 col4
and the same for all horizontal ligne.
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
for this jquery datatable serverside Showing 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) {}
}
---
---
Consider the following snippet.
"columns": [{
"data": "id"
},
{
"data": "attribute",
"name": "name",
"render": function(data, type, row, meta) {
return (row[1] + row[2] + row[3]);
},
"targets": 4
}]
See More: https://datatables.net/reference/option/columns.render
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.