[SOLVED] The common unknown parameter 0 for row 0

[SOLVED] The common unknown parameter 0 for row 0

EkosterEkoster Posts: 12Questions: 0Answers: 0
edited April 2014 in DataTables 1.10
Hello. I just started using datatables in an MVC 5 c# project. I made my controllers and views and added the js files. All in all, I get the layout as intended. Column headers are there, object is there but the data is giving me unknown parameter 0 for row 0.

Now I looked in the threads and some point to incorrect json result, but it's valid. Only the sequence may be wrong?

The controller returning the json:
[code][HttpGet]
public JsonResult ReservationTable()
{
var ReservationsTable = servReservation.GetReservationTable(User.ApplicationContactId);
var outJson = new
{
sEcho = "1",
iTotalRecords = servReservation.CountReservations(User.ApplicationContactId),
iTotalDisplayRecords = servReservation.CountReservations(User.ApplicationContactId),
aaData = ReservationsTable
};

return Json(outJson, JsonRequestBehavior.AllowGet);
}
[/code]

The list view cshtml
[code]


iReservationId
strObjectType
iObjectId
strDescription
dtStart
strObjectName




Loading data from server







$(document).ready(function () {
$('#tblReservationList').dataTable({
"bProcessing": false,
"bServerSide": true,
"aoColumnsDefs": [
{ "sName": "iReservationId" },
{ "sName": "strObjectType" },
{ "sName": "iObjectId" },
{ "sName": "strDescription" },
{ "sName": "dtStart" },
{ "sName": "strObjectName" }
],
"sAjaxSource": "/Reservation/ReservationTable",
});
});

[/code]

The json returned
[code]{
"sEcho": "1",
"iTotalRecords": 18,
"iTotalDisplayRecords": 18,
"aaData": [
{
"iReservationId": 10177,
"iObjectId": 21,
"strDescription": null,
"dtStart": "/Date(1395672300000)/",
"strObjectName": "AUDITTEST",
"strObjectType": "Room"
},
{
"iReservationId": 10178,
"iObjectId": 21,
"strDescription": null,
"dtStart": "/Date(1395849600000)/",
"strObjectName": "AUDITTEST",
"strObjectType": "Room"
},
{
"iReservationId": 10180,
"iObjectId": 21,
"strDescription": "fsdfae",
"dtStart": "/Date(1396086300000)/",
"strObjectName": "AUDITTEST",
"strObjectType": "Room"
},
{
"iReservationId": 10184,
"iObjectId": 14,
"strDescription": "test 4",
"dtStart": "/Date(1396417500000)/",
"strObjectName": "R NL-LEU-002",
"strObjectType": "Room"
},
{
"iReservationId": 10187,
"iObjectId": 21,
"strDescription": "Test calendar",
"dtStart": "/Date(1396548900000)/",
"strObjectName": "AUDITTEST",
"strObjectType": "Room"
},
{
"iReservationId": 10188,
"iObjectId": 21,
"strDescription": "ujsdhla;sd;",
"dtStart": "/Date(1396566000000)/",
"strObjectName": "AUDITTEST",
"strObjectType": "Room"
},
{
"iReservationId": 10185,
"iObjectId": 14,
"strDescription": "Test 5",
"dtStart": "/Date(1397123100000)/",
"strObjectName": "R NL-LEU-002",
"strObjectType": "Room"
},
{
"iReservationId": 10186,
"iObjectId": 14,
"strDescription": "Test met lege lists",
"dtStart": "/Date(1397208600000)/",
"strObjectName": "R NL-LEU-002",
"strObjectType": "Room"
},
{
"iReservationId": 96,
"iObjectId": 10009,
"strDescription": "",
"dtStart": "/Date(1397825100000)/",
"strObjectName": "Dell Beamer Mobile",
"strObjectType": "Asset"
},
{
"iReservationId": 97,
"iObjectId": 3,
"strDescription": "",
"dtStart": "/Date(1397825100000)/",
"strObjectName": "SONY Monitor 5050",
"strObjectType": "Asset"
},
{
"iReservationId": 10191,
"iObjectId": 14,
"strDescription": "sdasdasd",
"dtStart": "/Date(1397825100000)/",
"strObjectName": "R NL-LEU-002",
"strObjectType": "Room"
},
{
"iReservationId": 94,
"iObjectId": 10009,
"strDescription": "",
"dtStart": "/Date(1397828700000)/",
"strObjectName": "Dell Beamer Mobile",
"strObjectType": "Asset"
},
{
"iReservationId": 95,
"iObjectId": 3,
"strDescription": "",
"dtStart": "/Date(1397828700000)/",
"strObjectName": "SONY Monitor 5050",
"strObjectType": "Asset"
},
{
"iReservationId": 10190,
"iObjectId": 14,
"strDescription": "sdasdwsdas",
"dtStart": "/Date(1397828700000)/",
"strObjectName": "R NL-LEU-002",
"strObjectType": "Room"
},
{
"iReservationId": 10182,
"iObjectId": 16,
"strDescription": "hkjlh;",
"dtStart": "/Date(1397845800000)/",
"strObjectName": "R BE-SIN-003",
"strObjectType": "Room"
},
{
"iReservationId": 92,
"iObjectId": 10009,
"strDescription": "",
"dtStart": "/Date(1397915100000)/",
"strObjectName": "Dell Beamer Mobile",
"strObjectType": "Asset"
},
{
"iReservationId": 93,
"iObjectId": 6,
"strDescription": "",
"dtStart": "/Date(1397915100000)/",
"strObjectName": "Dell Workstation D-205",
"strObjectType": "Asset"
},
{
"iReservationId": 10189,
"iObjectId": 21,
"strDescription": "sdasdasd",
"dtStart": "/Date(1397915100000)/",
"strObjectName": "AUDITTEST",
"strObjectType": "Room"
}
]
}
[/code]

Can any one help?

Replies

  • EkosterEkoster Posts: 12Questions: 0Answers: 0
    I changed to 'aoColumnDefs' but no difference. I made a debug page too, but looking at it it gives the same as what I posted but in a different view. http://debug.datatables.net/inusel

    aoColumnDefs
    [code]"aoColumnDefs": [
    { "sTitle": "iReservationId", "aTargets": [0]},
    { "sTitle": "strObjectType", "aTargets": [1] },
    { "sTitle": "iObjectId", "aTargets": [2] },
    { "sTitle": "strDescription", "aTargets": [3] },
    { "sTitle": "dtStart", "aTargets": [4] },
    { "sTitle": "strObjectName", "aTargets": [5] }
    ],
    [/code]
  • EkosterEkoster Posts: 12Questions: 0Answers: 0
    Ah, now I got it. I changed back to "aoColumns" and changed sName into mDataProp. So that's a start. Now to get the paging, maxrows, search to work and just as important, figure how to change the column names to something meaningfull (and translatable) keeping this functioning.
This discussion has been closed.