DataTables seems to be trying to parse JSON object before it has been sent from server.
DataTables seems to be trying to parse JSON object before it has been sent from server.
I'm working on a dashboard for internal use at my company and am experiencing what I think is a timing issue with the data retrieval for the dataTables that I'm creating in the dashboard.
Here's the background ... I am loading three tables, one per jQueryUI tab. The data is coming from some rather large databases, one in excess of 200,000 records, therefore I'm using a server-side set up. Trouble is, the client-side seems to be trying to parse JSON objects before they are actually sent over from the server.
When I load the website, I first get the "DataTables warning: JSON data from server could not be parsed" message. At this point, firebug shows a response to the call as:
[quote]Reload the page to get source for: http://wshq-dwes01/test/grnelson/sbox/tools/pvsettings/branchData?sEcho=1&iColumns=25&sColumns=&iDisplayStart=0&iDisplayLength=50&mDataProp_0=0&mDataProp_1=1&mDataProp_2=2&mDataProp_3=3&mDataProp_4=4&mDataProp_5=5&mDataProp_6=6&mDataProp_7=7&mDataProp_8=8&mDataProp_9=9&mDataProp_10=10&mDataProp_11=11&mDataProp_12=12&mDataProp_13=13&mDataProp_14=14&mDataProp_15=15&mDataProp_16=16&mDataProp_17=17&mDataProp_18=18&mDataProp_19=19&mDataProp_20=20&mDataProp_21=21&mDataProp_22=22&mDataProp_23=23&mDataProp_24=24&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true& ... etc. [/quote]
I click "OK" on the pop-up and I get the header of the table and the "Processing" message. If I click one of the tabs housing the tables, it seems to jump start the processing again and the table gets correctly populated with the data. Now firebug shows a reapons that is actually a JSON object:
[quote] {"sEcho":"3","iTotalRecords":440,"iTotalDisplayRecords":50,"aaData":[["1110","8240","8200","Y","N","N","NOBLOCK","N","NORMAL","N","Y","Y","N","N","Y","N","N","Y","7302","Y","0.99","N","000001","1","\"devnull@wesco.com,devnul"],["1114","8520","8500","Y","N","Y","NOBLOCK","N","NORMAL","N","Y","Y","N","N","Y","N","N","Y","7302","Y","0.99","N","000001","1","\"UTILITYPRICING@WESCO.com"],["1116","8240","8200","Y","N","Y","NOBLOCK","Y","MARKET_DISPLAY","Y","Y","Y","N","N","Y","N","N","Y","7302","Y","0.99","Y","000001","2","\"PRICING_NE@WESCO.com,dev"],["1120","8520","8500","Y","N","Y","NOBLOCK","N","NORMAL","N","Y","Y","N","N","Y","N","N","Y","7302","Y","0.99","N","000001","1","\"UTILITYPRICING@WESCO.com"],["1219","8240","8200","Y","N","Y","NOBLOCK","Y","MARKET_DISPLAY","Y","Y","Y","N","N","Y","N","N","N","7302","Y","0.99","Y","000001","2","\"devnull@wesco.com,devnul"],["1225","8960","8900","Y","N","N","N","N","NORMAL","N","Y","Y","N","N","Y","N","N","N","7302","Y","0.00","N","000001","1","\"devnull@wesco.com,devnul"],["1231","8960","8900","Y","N","N","N","N","NORMAL","N","Y","Y","N","N","Y","N","N","N","7302","Y","0.99","N","000001","1","\"devnull@wesco.com,devnul"],["1232","8520","8500","Y","N","Y","NOBLOCK","N","NORMAL","N","Y","Y","N","N","Y","N","N","Y","7302","Y","0.99","N","000001","1","\"UTILITYPRICING@WESCO.com" ... etc. [/quote]
Similarly, when entering a keyword in the "Search:" entry field, the warning message will pop up before I've finished keying in the keyword. When close the pop-up, one of two things happens. Either I am allowed to finish keying in my search text and the filtering happens as expected or I can key in whatever I like, but nothing will happen, the search functionality falls completely apart.
Unfortunately, you will not be able to access the site as it not available from outside the company's intranet. I've run DataTables Debug and the generated code is "amiyet". The server-side is implemented in cakephp. I'll be happy to share with you whatever code you would like to see, but it really seems to be working, except for being a bit impatient.
So ... any suggestions?
Here's the background ... I am loading three tables, one per jQueryUI tab. The data is coming from some rather large databases, one in excess of 200,000 records, therefore I'm using a server-side set up. Trouble is, the client-side seems to be trying to parse JSON objects before they are actually sent over from the server.
When I load the website, I first get the "DataTables warning: JSON data from server could not be parsed" message. At this point, firebug shows a response to the call as:
[quote]Reload the page to get source for: http://wshq-dwes01/test/grnelson/sbox/tools/pvsettings/branchData?sEcho=1&iColumns=25&sColumns=&iDisplayStart=0&iDisplayLength=50&mDataProp_0=0&mDataProp_1=1&mDataProp_2=2&mDataProp_3=3&mDataProp_4=4&mDataProp_5=5&mDataProp_6=6&mDataProp_7=7&mDataProp_8=8&mDataProp_9=9&mDataProp_10=10&mDataProp_11=11&mDataProp_12=12&mDataProp_13=13&mDataProp_14=14&mDataProp_15=15&mDataProp_16=16&mDataProp_17=17&mDataProp_18=18&mDataProp_19=19&mDataProp_20=20&mDataProp_21=21&mDataProp_22=22&mDataProp_23=23&mDataProp_24=24&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true& ... etc. [/quote]
I click "OK" on the pop-up and I get the header of the table and the "Processing" message. If I click one of the tabs housing the tables, it seems to jump start the processing again and the table gets correctly populated with the data. Now firebug shows a reapons that is actually a JSON object:
[quote] {"sEcho":"3","iTotalRecords":440,"iTotalDisplayRecords":50,"aaData":[["1110","8240","8200","Y","N","N","NOBLOCK","N","NORMAL","N","Y","Y","N","N","Y","N","N","Y","7302","Y","0.99","N","000001","1","\"devnull@wesco.com,devnul"],["1114","8520","8500","Y","N","Y","NOBLOCK","N","NORMAL","N","Y","Y","N","N","Y","N","N","Y","7302","Y","0.99","N","000001","1","\"UTILITYPRICING@WESCO.com"],["1116","8240","8200","Y","N","Y","NOBLOCK","Y","MARKET_DISPLAY","Y","Y","Y","N","N","Y","N","N","Y","7302","Y","0.99","Y","000001","2","\"PRICING_NE@WESCO.com,dev"],["1120","8520","8500","Y","N","Y","NOBLOCK","N","NORMAL","N","Y","Y","N","N","Y","N","N","Y","7302","Y","0.99","N","000001","1","\"UTILITYPRICING@WESCO.com"],["1219","8240","8200","Y","N","Y","NOBLOCK","Y","MARKET_DISPLAY","Y","Y","Y","N","N","Y","N","N","N","7302","Y","0.99","Y","000001","2","\"devnull@wesco.com,devnul"],["1225","8960","8900","Y","N","N","N","N","NORMAL","N","Y","Y","N","N","Y","N","N","N","7302","Y","0.00","N","000001","1","\"devnull@wesco.com,devnul"],["1231","8960","8900","Y","N","N","N","N","NORMAL","N","Y","Y","N","N","Y","N","N","N","7302","Y","0.99","N","000001","1","\"devnull@wesco.com,devnul"],["1232","8520","8500","Y","N","Y","NOBLOCK","N","NORMAL","N","Y","Y","N","N","Y","N","N","Y","7302","Y","0.99","N","000001","1","\"UTILITYPRICING@WESCO.com" ... etc. [/quote]
Similarly, when entering a keyword in the "Search:" entry field, the warning message will pop up before I've finished keying in the keyword. When close the pop-up, one of two things happens. Either I am allowed to finish keying in my search text and the filtering happens as expected or I can key in whatever I like, but nothing will happen, the search functionality falls completely apart.
Unfortunately, you will not be able to access the site as it not available from outside the company's intranet. I've run DataTables Debug and the generated code is "amiyet". The server-side is implemented in cakephp. I'll be happy to share with you whatever code you would like to see, but it really seems to be working, except for being a bit impatient.
So ... any suggestions?
This discussion has been closed.
Replies
Allan
If you have any better I ideas, I would appreciate your help.
Good stuff - thanks for that. If you load http://debug.datatables.net/asusil and click on the 'Tables' tab and then 'Server interaction' for the first table - you'll see that it is not responding with JSON - hence the error. It is in fact responding with an XHTML document (from http://wshq-dwes01/test/grnelson/sbox/tools/pvsettings/branchData ).
The other two tables do have a JSON response from the server.
Allan
Anyway, I do want to thank you again for pointing me in the right direction and, much more so, thank you for this excellent tool.
Allan