Created
January 23, 2012 04:50
-
-
Save kagemusha/1660712 to your computer and use it in GitHub Desktop.
JQuery Datatables warning: Requested unknow parameter...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Versions: Datatables 1.8.x | |
If get error such as: | |
DataTables warning (table id = 'myTable'): Requested unknown parameter '2' | |
from the data source for row 0 | |
Means num of columns in table heading and in data as specified in | |
aoColumns do not match. Making sure are same number should fix this. | |
If using server side processing, make sure each col in aoColumns has an | |
mDataProp prop, else you will get the error above. mDataProp can be null | |
if you plan to overwrite in fnRowCallback. For example: | |
venuesTable = $("#venuesTable").dataTable | |
"bServerSide": true, | |
"sAjaxSource": "/venues", | |
"aoColumns":[ | |
{"sWidth": '200px', "mDataProp": "venue.name"}, | |
{"sWidth": '300px', "mDataProp": "venue.address"} | |
{"sWidth": '260px', "mDataProp": null, bSearchable: false, bSortable: false} | |
], | |
"fnServerData": ( sSource, aoData, fnCallback ) -> | |
$.getJSON sSource, aoData, (json) -> | |
#Do whatever additional processing you want on the callback | |
#, then tell DataTables | |
#e.g. json.aaData = [['1','1','1','1'],['2','2','2','2']] | |
fnCallback(json) | |
"fnRowCallback": (nRow, aData, iDisplayIndex) -> | |
venue = aData.venue | |
$('td:eq(2)', nRow).html "<a href='/venues/#{venue.id}'>Show</a>" | |
nRow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You helped me fix the issue. Thanks