DataTables warning (table id = 'table_Id'): Requested unknown parameter '0' from the data source

DataTables warning (table id = 'table_Id'): Requested unknown parameter '0' from the data source

aalap_patelaalap_patel Posts: 2Questions: 0Answers: 0
edited February 2013 in DataTables 1.9
Hi,

I am using your product, and it is fantastic. I need your help to resolve an issue that I have been facing since a couple of days.

I am getting the error 'Requested unknown parameter '0' from the data source'

The following points will help you to understand the scenario:
1) The no of columns for the data tables are dynamic. They change based on the selection of user selected values.
2) I am not using Ajax calls for fetching server side data and hence not using mprop.
3) I have checked and verified that the no of column headers and row values generated are same.

You can find the debug trace at : http://debug.datatables.net/evepax

Please help me resolve the issue at the earliest as it is little frustrating as I am not able to root cause the reason for the same.

Replies

  • ZacWolfZacWolf Posts: 5Questions: 0Answers: 0
    edited February 2013
    I just posted about this exactly same error. After two days of debugging I was able to track the issue down to an extra trailing comma in my aoColumns array. IE treats anything (even null) after defining an array element, as an additional array element.

    Look through all of your code, for any trailing commas:

    [code].dataTable(
    "aaData": [array],
    "aoColumns": [{ "mData": function(row,action,data){ do something},"sTitle":"Email", "sClass": "left", "bSortable": false, "bSearchable":false},]
    );[/code]

    In IE this results in the length of the aoColumns as 2 vs. 1 that it calculates in all the other browsers.
  • aalap_patelaalap_patel Posts: 2Questions: 0Answers: 0
    edited March 2013
    Thanks ZacWolf for the response.

    Please find the initialization code
    [code]
    var table = ".dataTable";
    var bJQueryUI = true;
    var sPaginationType = "full_numbers";
    var bPaginate = false;
    var bLengthChange = true;
    var bFilter = true;
    var bSort = false;
    var aaSorting = [];
    var bInfo = true;
    var bAutoWidth = true;
    var sScrollX = "100%";
    var sScrollY = "auto";
    var sScrollXInner = "150%";
    var bProcessing = true;
    var bScrollCollapse = true;
    var iDisplayLength = 200;
    var aoColumnDefs = [];
    var iCookieDuration = 7200; // default
    var sDom = 'C<"clear"><"fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"l<"#buttonPlaceholder">fr>t<"fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>';
    var bStateSave = false;
    var bRetrieve = false; // default
    var bScrollAutoCss = true; // default
    var bSortCellsTop = false; // default
    var iDeferLoading = null; // default
    var iDisplayStart = 0; // default
    var iScrollLoadGap = 100; // default
    var iTabIndex = 0; // default
    var oSearch = {"sSearch":""}; // default blank
    //var sAjaxSource = "/MITPromisReports/JSONProcessing/jsonString"; // default
    var sAjaxSource = null;
    var sServerMethod = "GET"; // default
    var sAjaxDataProp = "aaData"; // default
    var sCookiePrefix = "SpryMedia_DataTables_"; // default
    var aLengthMenu = [[10, 25, 50, 100, 200, -1], [10, 25, 50, 100, 200, "All"]];
    var oColVis = {"aiExclude": [ 0,1,2,3 ], "activate": "mouseover"};
    var bRemoveSpaces = true;

    var oTable = $.fn.initDatatable(table, bJQueryUI, sPaginationType, bPaginate, bLengthChange, bFilter, bSort, aaSorting, bInfo, bAutoWidth, sScrollX, sScrollXInner, bProcessing, bScrollCollapse, DisplayLength, aoColumnDefs, sScrollY, iCookieDuration, sDom, bStateSave, bRetrieve, bScrollAutoCss, bSortCellsTop, iDeferLoading, iDisplayStart, iScrollLoadGap, iTabIndex, oSearch,sAjaxSource, sServerMethod, sAjaxDataProp, sCookiePrefix, aLengthMenu, oColVis);
    [/code]

    I am not using aoColumns..i am using aoColumnDefs and passing an empty list. Hope i am not doing anything wrong over here.
  • ZacWolfZacWolf Posts: 5Questions: 0Answers: 0
    Sorry, I haven't been back in awhile. You'll probably want to check your ajax source itself to confirm that is not providing a trailing comma in the json that is being returned.
This discussion has been closed.