Error: Requested unknown parameter 'ReportID' for row 0, column 0.

Error: Requested unknown parameter 'ReportID' for row 0, column 0.

teddysmithdevteddysmithdev Posts: 1Questions: 1Answers: 0
edited June 2021 in Free community support

Getting this error. Looked all over Stackoverflow, datatables.net, google, etc but none have been able to point me in a general direction as to what's wrong.

Javascript

function getInspections(data) {
        var table = $('#inspectionTable').DataTable({
            "data": data,
            "serverSide": true,
            'responsive': true,
            "searching": true,
            "ordering": true,
            "autoWidth": false,
            "order": [[4, "asc"]],
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
            "pagingType": "full_numbers",
            "columns": [
                { "data": "ReportID" },
                { "data": "ClientName" },
                { "data": "PrimaryInspectorName" },
                { "data": "ReportNo" },
                { "data": "PropertyAddress" },
                {
                    "data": "InspectionDate",
                    "render": function (data) {
                        if (data == null) {
                            return "";
                        }
                        var pattern = /Date\(([^)]+)\)/;
                        var results = pattern.exec(data);
                        var dt = new Date(parseFloat(results[1]));
                        var month = (dt.getMonth() + 1).toString().length > 1 ? dt.getMonth() + 1 : "0" + (dt.getMonth() + 1)
                        var day = dt.getDate().toString().length > 1 ? dt.getDate() : "0" + dt.getDate()
                        return month + "/" + day + "/" + dt.getFullYear();
                    }
                },
                {
                    "data": "Archived",
                    "orderable": false,
                    "width": "30%",
                    "render": function (data) {
                        var buttons =
                            "<span><button type='button' id='docReport' class='btn btn-default' style='color:blue'><i class='fa fa-file-word-o'></i></button></span> " +
                            "<span><button type='button' id='pdfReport' class='btn btn-default' style='color:red; margin-right: 4px;'><i class='fa fa-file-pdf-o'></i></button></span>";
                        if (data) {
                            buttons += "<span><button type='button' id='unArchive' class='btn'>Un-Archive</button></span>"
                        }
                        return buttons;
                    }
                }
            ]
        }); 

JSON

Archived: false
{
ClientName: "Julie Kramer"
InspectionDate: "/Date(1562623200000)/"
PrimaryInspectorName: "Tom Armstrong"
PropertyAddress: "455 Gablefield Ct, Cincinnati, OH 45255"
ReportID: "2ccbd960-e0a7-4329-b36c-3ee032166073"
ReportNo: "070819TA2"
}

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Yep, that JSON doesn't look like the expected format. As you've enable server-side, the response needs to comply with the protocol. The protocol is discussed here. Also see examples here.

    Cheers,

    Colin

Sign In or Register to comment.