Requested unknown parameter

Requested unknown parameter

neptunianneptunian Posts: 6Questions: 0Answers: 0
edited February 2012 in General
So I'm getting the error " DataTables warning (table id = 'workflowsTable'): Requested unknown parameter '0' from the data source for row 0"

my code is:

[code]

var wTable = $('#workflowsTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sAjaxSource": "/api/jobs/workflows",
"aoColumnDefs": [
{ "aTargets": [0], "fnRender":function(o,val){

return '';
}},
{ "aTargets": [1], "mDataProp": "status" },
{ "aTargets": [2], "mDataProp": "label" },
{ "aTargets": [3], "mDataProp": "jobs_complete" },
{ "aTargets": [4], "mDataProp": "workflow" },
{ "aTargets": [5], "mDataProp": "jobs_failed" },
{ "aTargets": [6], "mDataProp": "jobs_waiting" },
{ "aTargets": [7], "mDataProp": "start" },
{ "aTargets": [8], "mDataProp": "end" }
]
});

[/code]

What I'm trying to do is load all columns except the first one from the json data source. the first one is just a static image for the collapse functionality. How do I get around this?

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Specify the sDefaultContent option for the first column (I'd use that rather than fnRender actually). At the moment DataTables is trying to get the property for the first column from the data, since it hasn't been told to do otherwise, and of course it is finding that the property isn't there.

    Allan
  • neptunianneptunian Posts: 6Questions: 0Answers: 0
    That worked, thanks. But why would DataTables try to get the property of the first column from the data source when mDataProp is not specified? Is that just always the default behavior?
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Yeah - the default is to use the column index as the data property. Otherwise you would always need to specify the data property for every initialisation which would be most annoying since the majority of cases don't need to do that (the majority of the time arrays are used rather than objects, since that's how DataTables used to require its data, until mDataProp).

    Allan
  • neptunianneptunian Posts: 6Questions: 0Answers: 0
    I see, thank you.
This discussion has been closed.