Я хотел бы знать, как изменить значение ячейки в Datatables.Мне нужно установить первую ячейку последней строки со значением rows.count ().
Вот моя функция для создания Datatables:
function callForStepBoxes(){
flow.steps = [];
flowChartJSON = new Array();
if(!typeof currentFlowsTable === 'undefined' || currentFlowsTable != null){
$('#flowsTable').DataTable().ajax.url(restURI + 'orch/search/operations/'+flow.name).load();
$('#flowsTable').DataTable().ajax.reload();
} else {
currentFlowsTable = $('#flowsTable').DataTable({
responsive: true,
columnDefs: [
{ responsivePriority: 1, targets: 0 },
{ responsivePriority: 2, targets: 4 },
{ responsivePriority: 3, targets: 2 },
{ responsivePriority: 4, targets: 3 },
{ responsivePriority: 5, targets: 4 },
{ responsivePriority: 6, targets: 5 }
],
ajax: {
"url": restURI + 'orch/search/operations/'+flow.name,
"contentType": "application/json",
"type": "GET",
"data": null,
},
order: [0, 'desc'],
scrollCollapse: true,
scrollX: false,
aLengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
],
iDisplayLength: -1,
"columns": [
{"data": "ROWID", "defaultContent": "", "sClass": "displayNone"},
{"data": "STEP", "defaultContent": "", "sClass": "text-center limitedWidth"},
{"data": "OPERATION_NAME", "defaultContent": "", "sClass": "text-center limitedWidth"},
{"data": null, "defaultContent": "<input type='number' class='flowTimeoutValue'/>", "sClass": "text-center limitedWidth"},
{"data": null, "defaultContent": "<input type='number' class='flowLimitValue'/>", "sClass": "text-center limitedWidth"},
{"data": null, "defaultContent": "<input type='checkbox' class='flowActiveValue' checked='false'/>", "sClass": "text-center limitedWidth"},
],
'rowCallback': function(row, data, index) {
// Retrieve rows.count
lastStep = currentFlowsTable.data().count();
// Retrieve last row
lastRow = currentFlowsTable.row(':last').data();
// Set the value
lastRow.STEP = lastStep;
currentFlowsTable.row(':last').data().STEP = lastStep;
},
'drawCallback': function(settings){
createNodesAndEdges(flowChartJSON);
}
});
};
}
Я получаю rows.count(), я извлекаю последнюю строку и устанавливаю значение, но оно не работает.Что я делаю неправильно ?Спасибо!