Datatables warning - Unknown Parameter

Datatables warning - Unknown Parameter

NfernusNfernus Posts: 3Questions: 0Answers: 0
edited August 2012 in DataTables 1.9
http://debug.datatables.net/eyiteg

From what I can tell in the Debugger, it sees all the data in my JSON, and I know the JSON is formatted correctly. For some reason, since I moved this out to a separate function which defines the columns it is inserting a false row "0" which of course is always null. Any thoughts?

[code]
function leaderboard(){
// Production End Point
// var jsonsource = sessvars.lbendpoint;
var jsonsource = 'js/json/playerResultsLB.json'
// Initialize Datatable
var oTable = $('#leaderboard').dataTable({
"sDom": '<"search"f>rt<"info"ip>',//<"pagination"p>',
"sPaginationType": "full_numbers",
"bLengthChange": false,
"iDisplayLength": 20,
"bProcessing": true,
"sAjaxSource": jsonsource,
"sAjaxDataProp": "leaderboardResults",
"aoColumns": columns(),
}); // End Datatable
}
function columns(){
var rows ='{ "sTitle" : "Position", "mDataProp": "curPosition" },';
rows+='{ "sTitle" : "Player Name", "mDataProp": "playerName" },';
if(sessvars.lbratio==="WvL"){
rows+='{ "sTitle" : "Ratio", "mDataProp": "ratio" },';
rows+='{ "sTitle" : "Wins", "mDataProp": "wins" },';
rows+='{ "sTitle" : "Losses", "mDataProp": "losses" },';
};
return rows;
}
[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    In the debugger if you click on "Tables" and then "Columns" you'll see that there are no columns registered.

    The reason for that is your columns() function is returning a string, not a Javascript object as required. In fact it needs to be an array of objects, not a string.

    Allan
  • NfernusNfernus Posts: 3Questions: 0Answers: 0
    That fixed it, thanks Allan!
This discussion has been closed.