Requested unknown parameter 'Id' for row 0. Function render problem

Requested unknown parameter 'Id' for row 0. Function render problem

agg9505agg9505 Posts: 11Questions: 5Answers: 0

Error: DataTables warning: table id=id- Requested unknown parameter 'Id' for row 0. For more information about this error, please see http://datatables.net/tn/4

$('#TicketDataTable').dataTable({

                ajax: "Ticket/GetTickets",

                columns: [
                    {
                        "data": "Id", "visible": true,
                        render: function (data, type, row) {//problem here
                            //alert(type);
                            if (type === 'display') {

                                return row.Id + '  <input  type="hidden" id="Id" name="Id" value="' + row.Id + '">'
                            }

                            //  return data;

                        }
                    },
                    { "data": "User", "visible": true },
                    { "data": "Date", "visible": true },
                    { "data": "Type1", "visible": true },
                    { "data": "ContactName", "visible": true },
                     { "data": "LastUpdate", "visible": true },
                      { "data": "AssigTo", "visible": true },
                       { "data": "AssigDate", "visible": true },
                        { "data": "Priority", "visible": true },
                         { "data": "Status", "visible": true },
                          { "data": "Done", "visible": true }

                ]
            });

Replies

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769
    edited April 2017

    Please follow the steps in the referenced technote and if you can't find the issue then post details of what you found and the returned JSON. Sounds like maybe your JSON response doesn't have an Id data object.

    Kevin

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    Why are you putting data you already have stored locally in a hidden textbox?

  • agg9505agg9505 Posts: 11Questions: 5Answers: 0

    @kthorngren yes, the JSON have the Id value

  • agg9505agg9505 Posts: 11Questions: 5Answers: 0

    I have found the problem, in a function where I can have a undefined value, I have to return the value, which I have commented in the function xD

  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin

    Ah yes - the columns.render, if defined, must return something. Well found.

    Allan

This discussion has been closed.