hi everyone,
i'm trying to dynamically populate a grid depending on some arbitrary json output and getting
Uncaught Error: infragistics.core.js:253 Cannot determine the data source type. Please specify if it is JSON or XML data.
the json data is coming proxy.php which is doing this:
$url="http://cnjtfs23:9090/AppManager/json/ListMonitor?apikey=f424a6c05c45381e78305a9653b56662&resourceid=10156726";$json=file_get_contents($url, false,$context); echo json_encode($json);
$.ajax({ type: "GET", url: "proxy.php", contentType: "application/json; charset=utf-8", dataType: "json", success: function(res) { $("#monitorGrid").igGrid({ dataType: "json", width: "80%", caption: "App Monitor", dataSource: res, //Array of objects defined abo autoGenerateColumns: true }); } });
i don't have a public access point to get to the json so i will paste as a response.
Any help is greatly appreciated.
thank you
Al
Uncaught Error: Cannot determine the data source type. Please specify if it is JSON or XML data.
found the problem....wasn't serializing to javascript
dataSource: jQuery.parseJSON( data ),
https://api.jquery.com/jquery.parsejson/
Thanks
since i'm encoding it in the php file, do i need to decode it when setting the grid data source. do i have to escape characters? this is a part of the exact text coming php get.
"{\"response\":{\"result\":[{\"DetailsPageURL\":\"\/showresource.do?resourceid=10156726&method=showResourceForResourceID&PRINTER_FRIENDLY=true\",\"TODAYUNAVAILPERCENT\":\"0.0\",\"Attribute\":[{\"DISPLAYNAME\":\"Response Time\",\"Value\":\"182\",\"Units\":\" ms\",\"AttributeID\":\"5002\"}],\"HEALTHATTRIBUTEID\":\"5001\",\"TARGETADDRESS\":\"\",\"RESOURCENAME\":\"FixFlyer Heartbeats\",\"TODAYAVAILPERCENT\":\"100.0\",\"TARGETNAME\":\"\",\"TODAYSCHEDDOWNPERCENT\":\"0.0\",\"AVAILABILITYATTRIBUTEID\":\"5000\",\"HEALTHSEVERITY\":\"5\",\"DISKUTIL\":\"-1\",\"MANAGED\":\"true\",\"PHYMEMUTIL\":\"-1\",\"AVAILABILITYMESSAGE\":\"Resource up.The resource FixFlyer Heartbeats is available.\",\"AVAILABILITYSEVERITY\":\"5\",\"TYPESHORTNAME\":\"Database Query Monitor\",\"TYPE\":\"QueryMonitor\",\"DESCRIPTION\":\"QueryMonitor Monitoring: for FixFlyer Heartbeats\",\"LASTPOLLEDTIME\":\"May 5, 2015 3:37 PM\",\"RESOURCEID\":\"10156726\",\"TODAYUNMANGDPERCENT\":\"0.0\",\"HEALTHMESSAGE\":\"Health of FixFlyer Heartbeats is clear.Root Cause :
Hi Maya, thank you for responding.
i'm actually using this ajax call and it's just not working. nothing is produced as output.
wouldnt it work this way?
$.ajax({ type: "GET", url: "proxy.php", contentType: "application/json; charset=utf-8", dataType: "json", success: function(data) { $("#monitorGrid").igGrid({ width: "80%", caption: "App Monitor", dataSource: data, //Array of objects defined above autoGenerateColumns: true, responseDataKey: "response.result" }); }});
<table id="monitorGrid" border=1 ></table>
thanks again
Hello Al,
Thank you for posting in our forum!
It seems that the json data you’re trying to bind to is wrapped in two additional objects: “response” and “result”.
In this case the responseDataKey option of the grid should be set in order to specify the property in the response that stores the actual data records.
In this case it should be:
responseDataKey: "response.result"
For more details you can refer to our Api documentation:
http://www.igniteui.com/help/api/2015.1/ui.iggrid#options:responseDataKey
Let me know if you have any additional questions or concerns.
Best Regards,
Maya Kirova
{"response":{"result":[{"DetailsPageURL":"/showresource.do?resourceid=10156726&method=showResourceForResourceID&PRINTER_FRIENDLY=true","HEALTHATTRIBUTEID":"5001","ASSOCIATEDGROUPS":"-","RESOURCENAME":"FixFlyer Heartbeats","Managed":"true","HEALTHSEVERITY":"5","AVAILABILITYATTRIBUTEID":"5000","AVAILABILITYMESSAGE":"Resource up. <br>The resource FixFlyer Heartbeats is available.","TYPESHORTNAME":"Database Query Monitor","TYPE":"QueryMonitor","DESCRIPTION":"QueryMonitor Monitoring: for FixFlyer Heartbeats","AVAILABILITYSEVERITY":"5","RESOURCEID":"10156726","HEALTHMESSAGE":"Health of FixFlyer Heartbeats is clear. <br>Root Cause : <br>1. FixFlyer Heartbeats is up<br>2. select user_id, last_hb_time, case when (current_timestamp - interval '3' minute) > last_hb_time the is up<br>3. select user_id, current_timestamp, (systimestamp-last_hb_time) *60 as lastheartbeat_minutes, last_h is up<br>4. select user_id, current_timestamp, (systimestamp-last_hb_time) *60 as lastheartbeat_minutes, last_hb is up<br>5. select user_id, current_timestamp, (current_timestamp-last_hb_time) *60 as lastheartbeat_minutes, la is up<br>6. select user_id, current_timestamp, last_hb_time, case when (current_timestamp - interval '3' minute) is up<br>7. select user_id, to_char(current_timestamp,'YYYY-MM-DD HH24:MI:SS') as Current_TimeStamp , last_hb_ti is up<br>8. select user_id, to_char(current_timestamp,'YYYY-MM-DD HH24:MI:SS') as Current_TimeStamp , last_hb_ti is up<br>9. select user_id, to_char(current_timestamp,'YYYY-MM-DD HH24:MI:SS') as Current_TimeStamp , last_hb_ti is up<br>10. select upper(user_id) as user_id, to_char(current_timestamp,'YYYY-MM-DD HH24:MI:SS') as Current_Time is up<br>11. select upper(user_id) is up<br>12. select upper(user_id) 174174 ' HEARTBEAT' as user_id, to_char(current_timestamp,'YYYY-MM-DD HH24:MI: is up<br>13. select upper(user_id) 174174 ' HEARTBEAT' as user_id, to_char(current_timestamp,'YYYY-MM-DD HH24:MI: is up<br>14. select upper(user_id) as user_id, to_char(current_timestamp,'YYYY-MM-DD HH24:MI:SS') as Current_Tim is up<br>15. select sub.*, case when sub.okhb=1 then 'DOWN' else 'UP' end as status FROM (SELECT USER_ID, PROD_MO is up<br>16. ffhandler-BARX_TCR-CAXTONPRD_TCR is up<br>17. ffhandler-BARX_TCR-CAXTONPRD_TCR --> STATUS UP contains UP (threshold).<br>18. ffhandler-BLPTSOX-CXTNTSOX is up<br>19. ffhandler-BLPTSOX-CXTNTSOX --> STATUS UP contains UP (threshold).<br>20. ffhandler-CITIFX-CAXTON_VELOSTP is up<br>21. ffhandler-CITIFX-CAXTON_VELOSTP --> STATUS UP contains UP (threshold).<br>22. ffhandler-FIXFLYER is up<br>23. ffhandler-FIXFLYER --> STATUS UP contains UP (threshold).<br>24. ffhandler-GTX-caxton_stp is up<br>25. ffhandler-GTX-caxton_stp --> STATUS UP contains UP (threshold).<br>26. ffhandler-NEOVDC-FIXFLYERDC is up<br>27. ffhandler-NEOVDC-FIXFLYERDC --> STATUS UP contains UP (threshold).<br>28. ffhandler-TT_ORDER-CAXTON is up<br>29. ffhandler-TT_ORDER-CAXTON --> STATUS UP contains UP (threshold).<br>30. ffhandler-TT_ORDER-MGSCAXTDRCL is up<br>31. ffhandler-TT_ORDER-MGSCAXTDRCL --> STATUS UP contains UP (threshold).<br>32. ffhandler-prod.fxgrid-order.Caxton.STP is up<br>33. ffhandler-prod.fxgrid-order.Caxton.STP --> STATUS UP contains UP (threshold).<br>34. validator is up<br>35. validator --> STATUS UP contains UP (threshold).<br>36. validatordd is up<br>37. validatordd --> STATUS UP contains UP (threshold).<br>","DISPLAYNAME":"FixFlyer Heartbeats","RCAPageURL":"/jsp/RCA.jsp?resourceid=10156726&attributeid=5001","HEALTHSTATUS":"clear","IMAGEPATH":"/images/queryMonitoring.gif","AVAILABILITYSTATUS":"up","LASTALARMTIME":"1430322217222"}],"uri":"/AppManager/json/ListMonitor"},"response-code":"4000"}