requested unknown parameter

requested unknown parameter

jkrobbinsjkrobbins Posts: 32Questions: 3Answers: 0
edited January 2014 in DataTables 1.9
Yes, another one. I've read the other posts on this topic but I'm still confused. The page works sometimes, and other pages using the same code work okay, but this one page is throwing this error. The debug info is at "uhamot" and it show 12 columns which is wrong. The query only returns 6 columns. Why does it work the first time but not on subsequent tries? It's also throwing an "oColumn is undefined" error. Here's my code:
[code]
$('#paraminputbtn').live('click', (function() {
$('#option').val($('#selectedtablefield').val());
$('#selectedtablefield').val()
$('#waitimgdiv').show();
$('#resultdiv').fadeOut();
$('#exportdiv').hide('fast');
var params = $('.inputfield').serialize();
$('#exportdiv').html('Download to Excel');
var oTable = $('#resulttable').dataTable();
oTable.fnDestroy();

$('#resulttable').dataTable({
'bFilter': true,
'bSort': false,
'bServerSide': true,
'bAutoWidth': true,
'sAjaxSource': '/mfgweb/DataExportAjax',
'bPaginate': true,
'sScrollY': '400px',
'sScrollX': '100%',
'sPaginationType': 'full_numbers',
'bScrollCollapse': true,
'bJQueryUI': true,
'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
var rowID = 'row' + iDisplayIndexFull;
$(nRow).attr('id', rowID);
if ($('#selectedtablefield').val() == 'compprodrep' && aData[0] != '') {
$(nRow).addClass('activerecord');
}
return nRow;
},
'fnServerData': function(sSource, aoData, fnCallback) {
$.getJSON(sSource, aoData.concat($('.inputfield').serializeArray()), function(json) {
fnCallback(json);
});
},
'fnInitComplete': function() {
$('div#resultdiv').show('fast', function() {
$('#bodydiv').css('padding-bottom', '0px');
oTable.fnAdjustColumnSizing();
oTable.fnLengthChange(25);
$('#exportdiv').show('fast');
$('#waitimgdiv').fadeOut(1000);
});
}
});
}));
[/code]
Ideas?

Replies

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    What does the HTML look like just before you initialise the table?

    [code]
    console.log( $('#resulttable').html();
    [/code]

    it does look like there are 12 columns in the HTML from the debug trace.

    Allan
  • jkrobbinsjkrobbins Posts: 32Questions: 3Answers: 0
    I figured out that the extra columns are from the previous query. I think my JS code was stepping on itself, trying to add the new headers before the old table was dropped. I've moved some code into callback functions to make the calls more synchronous and haven't been able to duplicate the problem since, but still testing. If it fails again, I'll be back. Thanks for getting back to me.
This discussion has been closed.