Uncaught Unable to find row identifier For more information
Uncaught Unable to find row identifier For more information
I've looked through the forms and documentation to try and find a solution to this problem. But have been unable too.
The JSON that is being used by datatables is below I've removed a couple lines of sensitive data but left forming intact in JSON as is passed to datatables via the xhr and reduced the number of items. The information is all displayed without issue in datatables but when clicking on one of the editable fields it does not allow editing and instead gives the following error. This occurred when implementing the server side portion of datatables. prior to this is was working correctly.
dataTables.editor.min.js:51 Uncaught Unable to find row identifier For more information, please refer to https://datatables.net/tn/14
{
"recordsTotal": 48,
"recordsFiltered": 48,
"data": [
{
"findingid": 1235,
"packageid": 2,
"title": "KB4525250: Windows 8.1 and Windows Server 2012 R2 November 2019 Security Update",
"vulnid": "6456-tcp-445",
"short_ruleid": "6456",
"severity": "I",
"check_type": "NESSUS",
"archerid": null,
"justification": null,
"mitigation": null,
"milestones": null,
"scheduled_completion_date": null,
"impact": null,
"recommendation": null,
"stig": "Nessus",
"version": "local",
"status": "Ongoing",
"status_date": "2000-01-01T01:01:01-01:01",
"scan_status": null,
"scan_date": null,
"host": "Host1",
"ip": "127.0.0.1",
"sampled": null,
"is_assessment": "Assessment",
"poc": null,
"bucket": "this",
"comments": "Test Comment\n\n",
"finding_details": "The remote host is missing one of the following rollup KBs : - 4525243 - 4525250"
},
{
"findingid": 6548,
"packageid": 2,
"title": "Microsoft Windows Type 1 Font Parsing Remote Code Execution Vulnerability (ADV200006)",
"vulnid": "65456-tcp-445",
"short_ruleid": "65456",
"severity": "I",
"check_type": "NESSUS",
"archerid": null,
"justification": null,
"mitigation": null,
"milestones": null,
"scheduled_completion_date": null,
"impact": null,
"recommendation": null,
"stig": "Nessus",
"version": "local",
"status": "Completed",
"status_date": "2000-01-01T01:01:01-01:01",
"scan_status": null,
"scan_date": null,
"host": "Host2",
"ip": "127.0.0.1",
"sampled": null,
"is_assessment": "Assessment",
"poc": null,
"bucket": null,
"comments": "Text: 2021-01-01",
"finding_details": "COMPLETED, Prior Plugin Output: File checked:\nC:\\Windows\\System32\\atmfd.dll: not renamed\n\nRegistry value checked:\nSoftware\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\DisableATMFD: NULL\n"
}
],
"draw": 1
}
The JS:
$(document).ready(function () {
var editor = new $.fn.dataTable.Editor({
ajax: '/api/findings_list/editor/?format=datatables&pkg=' + pkg,
table: "#FindingsTable",
idsrc: 'findingsid',
fields: [
{ label: 'findingid', name: 'findingid.id', type: 'hidden' },
{ label: 'PackageID', name: 'packageid', },
{ label: 'VulnID', name: 'vulnid', },
{ label: 'Status', name: 'status', },
{ label: 'Status Date', name: 'status_date', },
{ label: 'Scan Status', name: 'scan_status', },
{ label: 'Scan Date', name: 'scan_date', },
{ label: 'Host', name: 'host', },
{
label: 'Bucket', name: 'bucket',
type: 'select',
options: [
//..options
]
},
{ label: 'Comment', name: 'comments', type: 'textarea' },
{ label: 'Finding Detail', name: 'finding_details', },
]
});
var table = $('#FindingsTable').DataTable({
dom: 'lrtip',
processing: true,
serverSide: true,
ajax: '/api/findings_list/?format=datatables&pkg=' + pkg,
rowId: 'findingid',
lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
order: [[4, "asc"]],
pageLength: 25,
autoFill: true,
fixedHeader: true,
columns: [
//Looking into user fomatting option Hide columns ETC
{ data: 'findingid', },
{ data: 'packageid' },
{ data: 'title', render: $.fn.dataTable.render.ellipsis(22, true) },
{ data: 'vulnid' }, //VulnID
{ data: 'short_ruleid' },
{ data: 'severity' }, //Severity
{ data: 'check_type' },
{ data: 'archerid' },
{ data: 'justification' },
{ data: 'mitigation'},
{ data: 'milestones' },
{ data: 'scheduled_completion_date' },
{ data: 'impact' }, //Impact
{ data: 'recommendation' }, //Recommendation
{ data: 'stig' }, //STIG
{ data: 'version' }, //Version
{ data: 'status' }, //Status
{ data: 'status_date', render: $.fn.dataTable.render.moment('YYYY-MM-DDTHH:mm:ssZ', 'MMM-DD HH:ss') },
{ data: 'scan_status' }, //Scan Status
{ data: 'scan_date', render: $.fn.dataTable.render.moment('YYYY-MM-DDTHH:mm:ssZ', 'MMM-DD HH:ss') },
{ data: 'host' },
{ data: 'ip' },
{ data: 'sampled', },
{ data: 'is_assessment' },
{ data: 'poc' },
{ data: 'bucket' },
{ data: 'comments', render: $.fn.dataTable.render.ellipsis(25, true) },
{ data: 'finding_details', render: $.fn.dataTable.render.ellipsis(20, true) }
],
columnDefs: [
{ "visible": false, "targets": [ 1, 8, 9, 10, 11, 12, 13, 15] },
{ "targets": [2, 3, 27], className: "dt-readonly" },
{ "targets": [6, 7, 8, 9, 10, 11, 12, 13 , 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], className: "dt-readonly" },
{ "targets": [0, 1, 3, 4, 5], className: "dt-readonly text-center" },
],
initComplete: function () {
this.api().columns().every(function () {
//...Search Boxes
});
}
});
$('#clearall').on('click', function () {
//...clear search
table.search('')
table.draw();
});
$('#FindingsTable').on('click', 'tbody td:not(.dt-readonly)', function (e) {
editor.inline(this, {
submit: 'changed',
onBlur: 'submit'
});
});
});
The HTML:
<table class="table table-bordered table-hover table-sm" id="FindingsTable">
<thead class="thead-dark" data-spy="affix">
<tr id="DT_RowId">
<th class="text-nowrap align-middle">FindingID</th>
<th class="text-nowrap align-middle col-sm-auto">PackageID</th>
<th class="text-nowrap align-middle text-center">Title</th>
<th class="align-middle text-center">VulnID</th>
<th class="align-middle text-center">Short_ID</th>
<th class="align-middle text-center">Sev</th>
<th class="text-nowrap align-middle text-center">Check...</th>
<th class="align-middle text-center">AcherID</th>
<th class="text-nowrap align-middle text-center">Justification</th>
<th class="text-nowrap align-middle text-center">Mitigation</th>
<th class="text-nowrap align-middle text-center">Milestones</th>
<th class="text-nowrap align-middle">Schedualed_Completion_Date</th>
<th class="text-nowrap align-middle">Impact</th>
<th class="text-nowrap align-middle">Recommendation</th>
<th class="text-nowrap align-middle">STIG</th>
<th class="text-nowrap align-middle">Version</th>
<th class="text-nowrap align-middle">Status</th>
<th class="text-nowrap align-middle">Status Date</th>
<th class="text-nowrap align-middle">Scan Status</th>
<th class="text-nowrap align-middle">Scan Date</th>
<th class="text-nowrap align-middle">Host</th>
<th class="text-nowrap align-middle">IP</th>
<th class="text-nowrap align-middle">Sample</th>
<th class="text-nowrap align-middle">Is Asse...</th>
<th class="text-nowrap align-middle">POC</th>
<th class="text-nowrap align-middle">Bucket</th>
<th class="text-nowrap align-middle">Comment</th>
<th class="text-nowrap align-middle">Finding Detail</th>
</tr>
</thead>
</table>
This question has an accepted answers - jump to answer
Answers
I've run the debug as well the code it spat out was omugih
It looks like two things wrong here. First, it should be
idSrc
, notidsrc
(note the camel case), and you've named the fieldfindingsid
first, thenfindingid
later.Could you fix those two, please, and see if that does the trick,
Colin