DataTables warning ... Requested unknown parameter - Page 2

DataTables warning ... Requested unknown parameter

2

Replies

  • danisukmadanisukma Posts: 1Questions: 0Answers: 0
    thanks to azka2010, i've the same problem and the same solution
    azka said "Ah, find it myself ... header table has more column than the data itself ..."
  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    @argentario84:
    > The table is not well formed

    I don't quite understand - what does the table look like in that case? The HTML table must match the formula: rows * columns = cells. Otherwise it simply won't work and you'll get the error described. If you want no rows, then output no rows in the tbody.

    @danisukma:
    Good to hear you got it sorted.

    Allan
  • shailendrashailendra Posts: 1Questions: 0Answers: 0
    http://beslaked.com/viewtopic.php?f=2&t=30241
  • kamleshkamlesh Posts: 0Questions: 0Answers: 0
    datatables warning (table id='datatables');Requested unknown parameter '8' from the data source for row 0
    Please Help!!
  • jamjam Posts: 2Questions: 0Answers: 0
    Me too, please help me.
    I've read answers.. But, I don't know the cause of this problem.
    아.. 여기 누구 한국사람 없어요?? 이것 좀 해석 해주세요ㅜㅜ 진짜 모르겠어요.. 헐..
    답변을 다 봤는데도 무슨 소린지 모르겠어요.. :-(
  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    Please please please give me a link! :-).

    There are a number of things that can cause this, and I'd need to see the page to be sure what is happening.

    I am developing software to help with debugging this kind of thing right now - but for now, I'd need to see the page to have any chance of suggesting what is wrong.

    Allan
  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    I'll do a proper announcement later on, but I'd be interested if you could give my new debugging tool a go: http://debug.datatables.net . It will gather the information about your table and submit it to my server so I can see what might be happening.

    Allan
  • brockbrock Posts: 1Questions: 0Answers: 0
    I just had the same problem, but only in IE. (version 6 and 8 I think), due to an extraneous comma after the last column. I guess Javascript handles array definitions differently between the browsers.

    Error in IE, Fine in Chrome:
    [code]
    "aoColumns": [
    null,
    { "sType": 'num-html' },
    null,
    ]
    [/code]

    Find in IE, Fine in Chrome:
    [code]
    "aoColumns": [
    null,
    { "sType": 'num-html' },
    null
    ]
    [/code]

    Posting just in case someone else has the same problem.
  • boylesboyles Posts: 1Questions: 0Answers: 0
    edited February 2012
    I recently had this problem because I was dynamically selecting which columns to display in my table based on user input. Based on the comments above, my solution was to make the columns I didn't want to show up render a space even though they were not visible and set bDestroy to true.

    [code]
    function getCols(showAll){
    var cols = [];
    cols.push({sTitle:"Col 1"});
    cols.push({sTitle:"Col 2"});

    if(showAll == "true"){
    cols.push({sTitle:"Col 3"});
    cols.push({sTitle:"Col 4"});
    } else {
    cols.push({bVisible:false, fnRender:function(){ return ' '; }})
    cols.push({bVisible:false, fnRender:function(){ return ' '; }})
    }
    return cols;
    }

    $('#table').dataTable({
    bDestroy:true,
    aoColumns: getCols(),
    sAjaxSource: "someurl.php"
    });
    [/code]
  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    @brock and boyles: Thanks very much for the feedback - there are certainly a lot of ways in which this issue can arise!

    For anyone else interested in this topic please refer to this new FAQ: http://datatables.net/faqs#unknown_parameter . If it doesn't help, post in a _new_ thread with your debugger debug code.

    Allan
  • smasilasmasila Posts: 2Questions: 0Answers: 0
    If you are using JSONObject then this can happen if the data returned by the POJO/bean class is null.
  • acnuacnu Posts: 3Questions: 0Answers: 0
    Hi

    I am new to datatables. I am getting data from SpringMVC controller. The problem is Datatable data not displaying but in the footer is displaying "Showing 1 to 10 of 10 entries" message also footer message changed correctly when I changed not next page.

    Also it displaying Datatables warning(tableid='companies'): Requested unknown parameter '0' from the datasource for row 0


    The JSON

    iTotalDisplayRecords
    10

    iTotalRecords
    10

    sEcho
    1

    rows
    [Object { name="product-1", id=1, description="product-1-description"}, Object { name="product-2", id=2, description="product-2-description"}, Object { name="product-3", id=3, description="product-3-description"}, 7 more...]


    Script
    $(document).ready(function () {
    $("#companies").dataTable({
    "bServerSide": true,
    "url":'/products',
    "sPaginationType": "full_numbers",
    "bJQueryUI": true,
    "sAjaxDataProp": "rows"
    });
    });





    id
    Name
    Description





    Loading data from server




    much appreciated your help

    Regards
    acnu
  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    To use objects, you need to tell DataTables which property from the objects belongs in each column - see: http://datatables.net/blog/Extended_data_source_options_with_DataTables

    Allan
  • reddyonrailsreddyonrails Posts: 1Questions: 0Answers: 0
    DataTables warning : Requested unknown parameter from the data source for row

    I solved this by using like this under "aoColumns":
    { "sTitle": "YourName", "sClass": "center","sDefaultContent": " "}
    Sometimes your source may have null values. sorting may not work properly. Thats why "sDefaultContent": " " is necessary.. again this is one of the cause, but there could be other issues.

    Jagan Reddy ch
  • adromiladromil Posts: 53Questions: 4Answers: 0
    I encountered the same error prompt but I am not using server-side processing.

    I used php to generate the table object like echo [code]"..."[/code]

    to be more specific here is an excerpt from my php code:
    [code]
    echo "



    <!--th style='width:20%'>
    Reference No
    Program
    Type
    SARO No
    Amount
    Date
    Constiuent as
    Beneficiary




    Details


    ";
    $hstsql = mysql_query($sqlstr);
    $total_amt=0;
    $fname = $fname;
    $lname = $lname;
    if(mysql_num_rows($hstsql)>0){
    while($hstrow=mysql_fetch_assoc($hstsql)){
    $refnum = $hstrow['refnum'];
    $type = $hstrow['type'];
    $prog_name = $hstrow['prog_name'];
    $txtsaro = $hstrow['saro'];
    $saro_d = $hstrow['saro_d'];
    $amount = $hstrow['amount'];
    $con_as = $hstrow['consti_as'];
    $gdate = date('m/d/Y',strtotime($hstrow['grant_date']));
    //$consti_as = $row['consti_as'];
    $lblgrant = $hstrow['grant_label'];
    $capfname = $hstrow['capfname'];
    $caplname = $hstrow['caplname'];
    $relation = $hstrow['relation'];
    $capbrgy = $hstrow['brgy'];
    $capcity = $hstrow['ct'];
    $details = $hstrow['details'];
    // $lbl="";$lblname="";
    // if($con_as=='CLAIMANT'){
    // $claimant = $fname." ".$lname;
    // $lbl = $lblgrant;
    // $lblname = $capfname." ".$caplname;
    // }else{
    // $claimant = $capfname." ".$caplname;
    // $lbl = $con_as;
    // $lblname = $fname." ".$lname;
    // }
    echo "
    $refnum
    $prog_name
    $type
    $txtsaro
    ".number_format($amount, 2, '.', ',')."
    $gdate
    $con_as
    $lblgrant
    $capfname $caplname
    $relation
    $capbrgy, $capcity
    $saro_d
    $details
    ";
    $total_amt = floatval($total_amt) + floatval($amount);
    }
    }else{
    echo "No Records Found.";
    }
    echo"




    Total Amount
    ".number_format($total_amt, 2, '.', ',')."












    ";
    [/code]

    I think there is something wrong with my javascript:
    [code]
    oTable = $('#tblhist').dataTable({
    "bPaginate": false,
    "bLengthChange": false,
    "bFilter": false,
    "bInfo": false,
    "bAutoWidth": true,
    "aoColumnDefs": [
    {"bVisible": false, "aTargets": [ 7 ]},
    {"bVisible": false, "aTargets": [ 8 ]},
    {"bVisible": false, "aTargets": [ 9 ]},
    {"bVisible": false, "aTargets": [ 10 ]},
    {"bVisible": false, "aTargets": [ 11 ]},
    {"bVisible": false, "aTargets": [ 12 ]}
    ],
    "bSort": true
    });

    var nTr;
    var tn = oTable.fnSettings().fnRecordsTotal();
    if(tn>0){
    for(var n=0; n
  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    See http://datatables.net/faqs#unknown_parameter - I suspect it is the colspan in your tbody.

    Allan
  • robertbrowerrobertbrower Posts: 158Questions: 1Answers: 0
    If the data source is the DOM, the HTML table itself, then this error seems to be caused by EMPTY CELLS in conjunction with using fnRender or some other options. In my case, I use the first column as a means to select a row via a checkbox.

    settings.$dataTable = $this.find("#TrendParametersTable").dataTable({
    "bJQueryUI": true
    , "sPaginationType": "full_numbers"
    , "sScrollY": "250px"
    , "aoColumnDefs": [
    {
    "aTargets": [0]
    , "bSearchable": false
    , "fnRender": function (obj) {
    return '';
    }
    , "bUseRendered": false
    }
    , {
    "aTargets": [1]
    , "bSearchable": false
    , "bVisible": false
    }
    ]
    , "aaSorting": [[2, "asc"]]
    });

    I fixed it by putting "unchecked" in the cells of the first column as my table is rendered. My page's plugin exposes $.fn.TrendParameters.Toggle() method which updates the value of the data to either "checked" or "unchecked".

    I think it was the empty cells.
  • r_l_parkerr_l_parker Posts: 1Questions: 0Answers: 0
    @brock -- thanks that was my problem--IE didn't like the extra comma!!

    @allan -- thanks for an awesome tool.
  • tashtash Posts: 13Questions: 0Answers: 0
    edited August 2012
    I'm experiencing the same issue, and I haven't been able to figure it out yet. I tried your debugging tool, but it tells me jquery isn't loaded on the page. However, it is. I have some jquery calendar stuff working on the same page. Anywhow, here is my error: DataTables warning (table id = 'search-results-table'): Requested unknown parameter '7' from the data source for row 0

    My initialization code:
    [code]
    $('#search-results-table').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "../dataTablesServerSide.php",
    "bPaginate": true,
    "bFilter": false,
    "bSort": true,
    "sPaginationType": "full_numbers",
    "bAutoWidth": false,
    "bLengthChange": false,
    "bInfo": true,
    "sDom": 'T<"clear">lfrtip',
    "oTableTools": {
    "sSwfPath": "/common/TableTools-2.1.2/media/swf/copy_csv_xls_pdf.swf"
    },
    "iDisplayLength": 20
    } );
    [/code]
    my server-side script is literally a copy from http://datatables.net/release-datatables/examples/data_sources/server_side.html just replacing the fake db info with my db info.

    Note: My array in the server-side script looks like this:
    $aColumns = array( 'jobnum', 'jobtype', 'jobdesc', 'jobstart', 'jobend', 'jobfinished', 'jobnotes' );

    My table includes a few other columns that aren't database fields. How can I add them in? Is that causing my problem? I'm very stumped right now. I'd offer you a link but this is on an intranet that requires login.

    Edit: I forgot to include the json being returned. Sorry if it is in a terrible format:
    [code]
    {"sEcho":1,"iTotalRecords":"568","iTotalDisplayRecords":"568","aaData":[["11-AZ124-45","Fabrication","CO 12-co162-224","2012-08-13",null,"2012-08-14","complete"],["11-AZ124-45","Shipping","CO 12-co162-224","2012-08-27","2012-09-02",null,"complete"],["11-AZ124-45","Detailing","CO 12-co162-224","2012-07-23","2012-07-29","2012-08-08","complete"],["11-AZ158-24","Shipping","AZ","2012-08-06","2012-08-12",null,"COMPLETE ON SITE 7-16"],["11-AZ176-5","Shipping","CO 12-co368-211","2012-07-09",null,"2012-07-17","2 E2C gate hinges"],["11-AZ176-5","Fabrication","CO 12-co368-211","2012-07-09",null,"2012-07-12","2 E2C gate hinges X"],["11-GM150-34","Shipping","CO 12-co383-242","2012-08-20","2012-08-26",null,"complete FED EX 8.23"],["11-GM150-34","Fabrication","CO 12-co383-242","2012-08-13",null,"2012-08-14","complete"],["11-GM150-34","Detailing","CO 12-co383-242","2012-08-06","2012-08-12","2012-08-10","complete"],["11-GM150-34","Shipping","CO 12-co348-200","2012-07-23",null,"2012-07-17","complete X RK STEEL"],["11-GM150-34","Fabrication","CO 12-co348-200","2012-07-16",null,"2012-07-16","complete"],["11-GM150-34","Detailing","CO 12-co348-200","2012-07-02","2012-07-08","2012-07-09","complete"],["11-GM209-1","Shipping","ALMO","2012-07-09",null,"2012-07-16","complete X OUT\/7.13-12PM"],["11-GM221-3","Shipping","CO 12-co298-193","2012-07-16",null,"2012-07-30","complete X"],["11-SC103-87","Shipping","CO 12-co334-207","2012-07-09","2012-07-15",null,"complete"],["11-SC103-87","Fabrication","CO 12-co334-207","2012-07-09",null,"2012-07-17","complete"],["11-SC107-70","Shipping","CO 12-co364-220","2012-07-30",null,"2012-08-02","complete X OUT\/"],["11-SC107-70","Fabrication","CO 12-co364-220","2012-07-30",null,"2012-08-07","complete issue 1 X"],["11-SC107-70","Detailing","CO 12-co364-220","2012-07-23",null,"2012-07-23","complete"],["11-SC110-82","Fabrication","CO 12-co352-205","2012-07-09",null,"2012-07-17","complete X"]]}
    [/code]
  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    edited August 2012
    @tash - You've got a few `null` values in your data there. You need to tell DataTables how to display `null` through the use of sDefaultContent . It won't automatically put an empty string in because null !== "".

    Allan
  • tashtash Posts: 13Questions: 0Answers: 0
    Allan, I've tried aoColumnDefs but can't seem to get it right. If you look at my init code in my post from earlier, can you tell me how I'd accomplish the task?
  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    Easiest option would be to add:

    [code]
    aoColumnDefs: [
    {
    sDefaultContent: '',
    aTargets: [ '_all' ]
    }
    ]
    [/code]

    Allan
  • tashtash Posts: 13Questions: 0Answers: 0
    That seems to have done the trick. This next question might be something for a different topic, so please let me know if I shouldn't be asking here. My table has a couple of columns where data isn't retrieved from the same table as the rest of the columns. So, in my $aColumns array I have omitted them. But now my dataTable is out of whack. All of the data is there, but the th's don't line up correctly with the data. Does that ring a bell?
  • tashtash Posts: 13Questions: 0Answers: 0
    oh, I guess there was that issue from my last comment, and the fact when I load my page, I can now see the pre-dataTables formatting of the table for about a second, then the neat looking dataTable. Know how I can go about fixing that?
  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    You could put it in a display:none element and then make it visible in fnInitComplete (and call fnAdjustColumnSizing), or an element with height:1px.

    ideally it would be good to track different issues in individual threads please - otherwise I get myself very confused, particularly in a thread as long as this one.

    Allan
  • muhmalik79muhmalik79 Posts: 1Questions: 0Answers: 0
    edited January 2013
    i have the same problem in IE 8 when i look back carefully to my code i found that the table body tag was not closed properly, so when i closed that body tag properly the warning message gone away and data table start working properly. So first check your code carefully.
  • mokumaxmokumax Posts: 7Questions: 0Answers: 0
    I have the same issue. Here is the debug code. I'm not sure what's up. I want to use server-side paging but can't get static json working yet. http://debug.datatables.net/ococix

    Any help would be greatly appreciated!
  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    You've used an object data source, but not told DataTables what object properties to use for each column. See: http://datatables.net/blog/Extended_data_source_options_with_DataTables

    Allan
  • RadamantRadamant Posts: 1Questions: 0Answers: 0
    DataTables warning (table id = 'GiftsTable') : Requested unknown parameter '2' from the data source for row 0
    The table:
    http://debug.datatables.net/apolav
    Please Help!!
    Thanks in advance!
  • josys64josys64 Posts: 4Questions: 0Answers: 0
    edited June 2013
    I can't figure out why i still have this warning : [quote]DataTables warning Requested unknown parameter '2' from the data source for row 0[/quote]

    the request :
    [code]
    cols : col_nom
    iColumns : 6
    iDisplayLength : 10
    iDisplayStart : 0
    mDataProp_0 : 0
    mDataProp_1 : 1
    mDataProp_2 : 2
    mDataProp_3 : 3
    mDataProp_4 : 4
    mDataProp_5 : 5
    sColumns :
    sEcho : 1
    [/code]


    this is the JSON response :
    [code]{"sEcho":1,"iTotalRecords":8125,"iTotalDisplayRecords":"8125","aaData":[["","ALLAL BEN MAATI"],["","BONIFACE"],["","BOULONGNE"],["","CABON"],["","CABON"],["","DOYEN"],["","DUVERCHIN"],["","GALLIET"],["","GAUTIER"],["","GRIVELET"]]}[/code]

    any idea ?
This discussion has been closed.