{"id":3134,"date":"2014-03-16T22:56:27","date_gmt":"2014-03-16T22:56:27","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/16\/smartgwt-listgrid-json-issue-collection-of-common-programming-errors-2\/"},"modified":"2014-03-16T22:56:27","modified_gmt":"2014-03-16T22:56:27","slug":"smartgwt-listgrid-json-issue-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/16\/smartgwt-listgrid-json-issue-collection-of-common-programming-errors-2\/","title":{"rendered":"smartGWT ListGrid JSON issue-Collection of common programming errors"},"content":{"rendered":"<p>I have created a REST API at URL: <code>http:\/\/localhost:8888\/rest\/contacts<\/code> with this JSON output:<\/p>\n<pre><code>{\n    \"contact\": {\n        \"address\": [\n            {\n                \"city\":\"Shanghai\",\n                \"street\":\"Long Hua Street\"\n            },\n            {\n                \"city\":\"Shanghai\",\n                \"street\":\"Dong Quan Street\"\n            }\n        ],\n        \"id\": \"huangyim\",\n        \"name\": \"Huang Yi Ming\"\n   }\n}\n<\/code><\/pre>\n<p>I want to print only the id value in a smartGWT ListGrid.<\/p>\n<pre><code>public class ExampleEntry implements EntryPoint {\n    #Override\n    public void onModuleLoad() {\n        DataSource dataSource = new DataSource();  \n        dataSource.setDataFormat(DSDataFormat.JSON);  \n        dataSource.setDataURL(\"http:\/\/localhost:8888\/rest\/contacts\");\n        dataSource.setRecordXPath(\"\/contact\");\n\n        DataSourceTextField field = new DataSourceTextField(\"id\", \"id\");\n        dataSource.addField(field);        \n\n        final ListGrid grid = new ListGrid();  \n        grid.setDataSource(dataSource);\n        grid.setAutoFetchData(true);  \n        grid.draw();\n    }\n}\n<\/code><\/pre>\n<p>But it is throwing the following exception:<\/p>\n<pre><code>15:33:12.766 [ERROR] [jerseyexample] 15:33:12.747:XRP2:WARN:RPCManager:xmlHttpRequest.getAllResponseHeaders() returned null\ncom.smartgwt.client.core.JsObject$SGWT_WARN: 15:33:12.747:XRP2:WARN:RPCManager:xmlHttpRequest.getAllResponseHeaders() returned null\n    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\n    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)\n    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)\n    at java.lang.reflect.Constructor.newInstance(Unknown Source)\n    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)\n    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)\n    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)\n    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)\n    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)\n    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)\n    at java.lang.Thread.run(Unknown Source)\n<\/code><\/pre>\n<p>I tried searching google to find a fix but that did not help. Please let me know if anyone knows a solution for this issue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have created a REST API at URL: http:\/\/localhost:8888\/rest\/contacts with this JSON output: { &#8220;contact&#8221;: { &#8220;address&#8221;: [ { &#8220;city&#8221;:&#8221;Shanghai&#8221;, &#8220;street&#8221;:&#8221;Long Hua Street&#8221; }, { &#8220;city&#8221;:&#8221;Shanghai&#8221;, &#8220;street&#8221;:&#8221;Dong Quan Street&#8221; } ], &#8220;id&#8221;: &#8220;huangyim&#8221;, &#8220;name&#8221;: &#8220;Huang Yi Ming&#8221; } } I want to print only the id value in a smartGWT ListGrid. public class ExampleEntry implements [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3134","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3134"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3134\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}