I am using JTables with Spring / Ajax , the data is being returned from Spring and is visible in Firebug.
However w开发者_如何学Gohen the JTable is getting painted , I am getting this error
Requested unknown parameter '1' from the data source for row 0
I am not getting the root cause of the issue. Below is the code snippet
$('#dataTable').dataTable({"aaData" : data,
"aoColumns": [
{ "sTitle": "Name" },
{ "sTitle": "Address" },
{ "sTitle": "Phone" },
{ "sTitle": "Email" },
]
});
Can anybody please help.
Thanks in advance , Vivek
Root cause of issue found.
The reason due to which I was getting this error was because I was trying to send a JAVA STRING Array Object to Datatables, which expects a JSON array.
Hence due to the mismatch in the type of Object expected, I was getting the above mentioned error.
Resolved the issue , by converting the String array into a JSON Array like this
JSONArray jsonArray = JSONArray.fromObject(Arr);
精彩评论