Requested unknown parameter

Requested unknown parameter

tinker1123tinker1123 Posts: 22Questions: 0Answers: 0
edited July 2012 in General
Hi,

I'm new to DataTables.

I decided to go the "server side" process route in implementing DataTables in my JSP site. I have a lot of records and IE 8 seems to lack the horse power for it. I finally got all of that coding done today and then got this error when the page loaded:

[code]DataTables warning (table id = 'results_table'): Requested unknown parameter '0' from the data source for row 0[/code]

I Googled on the error, came here, went to a few other places and saw that most of these errors are malformed JSON responses. I wrestled with my code for a while and got my JSON response looking similar ( but not 100% the same ) to the example in this guide:
http://datatables.net/usage/server-side


The big difference I noticed was no provision for column names in my JSON. The examples I saw for doing server side set ups didn't have any.
Do I need to do anymore than I am doing or is something still wrong with my JSON?

Here are the relevant bits from my results.jsp:

[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



ACME: search results in a nice DataTables.net Plugin








$(document).ready(function() {
$('#results_table').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sScrollX": "600px",
"sServerMethod": "POST",
"sAjaxSource": "/acme/resultstable",
} );
} );









 
ID
NO_PRINT
Full Name
Email Address
Phone Number
Organization
Organization Code
Position
Employee Type








[/code]

Here is the JSON response I've been sending to it:


[code]
{
"sEcho" : 1,
"iTotalRecords" : 1,
"iTotalDisplayRecords" : 1,
"aaData" : [ {
"person_id" : "888888",
"ID" : "999999",
"no_print" : " ",
"fullname" : "Obama, Willard",
"email_address" : "barry@whitehouse.gov",
"current_phone_number" : "303-867-5309",
"title" : " ",
"office" : " ",
"position" : "Contractor",
"empl_code" : "CONT"
} ]
}
[/code]

Any ideas what I need to change?

Thanks in advance

Steve

Replies

  • tinker1123tinker1123 Posts: 22Questions: 0Answers: 0
    I didn't think I need to do this, as it wasn't done in any of the examples for implementing server side processing ( at least the ones I saw ).

    I had to implement an "aoColumns" parameter

    Here is an example of setting up aoColumns
    https://gist.github.com/1660712

    HTH to anyone Googling on a similar problem

    Steve
This discussion has been closed.