Requested unknown parameter 'Id' for row 0. Function render problem
Requested unknown parameter 'Id' for row 0. Function render problem
agg9505
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 }
]
});
This discussion has been closed.
Replies
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
Why are you putting data you already have stored locally in a hidden textbox?
@kthorngren yes, the JSON have the Id value
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
Ah yes - the
columns.render
, if defined, must return something. Well found.Allan