开发者

Requested unknown parameter '1' from the data source for row 0 ( JTable Issue )

开发者 https://www.devze.com 2023-04-13 06:49 出处:网络
I am using JTables with Spring / Ajax , the data is being returned from Spring and is visible in Firebug.

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消