Hi Isomorphic,
I am trying to fetch data from a datasource into a TableView Widget.
Here is the datasource definition, stored in the ds directory:
And here is the code to fetchdata and fiil the tableView:
I have set the resthandler and datasourceloader servlets in the web.xml as follows:
[code]
<servlet>
<servlet-name>RestHandler</servlet-name>
<servlet-class>com.isomorphic.servlet.RESTHandler</servlet-class>
<init-param>
<param-name>defaultDataFormat</param-name>
<param-value>json</param-value>
</init-param>
<init-param>
<param-name>wrapJSONResponses</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>DataSourceLoader</servlet-name>
<servlet-class>com.isomorphic.servlet.DataSourceLoader</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RestHandler</servlet-name>
<url-pattern>/isomorphic/RESTHandler</url-pattern>
</servlet-mapping>
<!-- DataSourceLoader requests -->
<servlet-mapping>
<servlet-name>DataSourceLoader</servlet-name>
<url-pattern>/isomorphic/DataSourceLoader</url-pattern>
</servlet-mapping>
[code]
I am using the smartgwt mobile jar file which creation date is May 10th 2012.
When I try to fetch data I get the following exception:
which it seems that the from config method of the datasource class has a bug on casting a record to a datasourcefield.
Could please tell me if I am using the datasource load correctly and if its a bug, o otherwise I am doing something wrong?
Thanks in advance,
Pablo
I am trying to fetch data from a datasource into a TableView Widget.
Here is the datasource definition, stored in the ds directory:
Code:
Prueba.xml <DataSource ID="prueba" serverType="sql" tableName="prueba" > <fields> <field name="pruebaID" type="sequence" title="pruebaID" primaryKey="true" hidden="true"/> <field name="nombrePrueba" type="text" title="Nombre"/> </fields> </DataSource>
Code:
DataSource.loadDataSource("prueba", new LoadDSCallback() { public void execute(DataSource[] dsList) { // start creating and binding widgets TableView tv = new TableView(); tv.setDataSource(dsList[0]); tv.fetchData(); } });
[code]
<servlet>
<servlet-name>RestHandler</servlet-name>
<servlet-class>com.isomorphic.servlet.RESTHandler</servlet-class>
<init-param>
<param-name>defaultDataFormat</param-name>
<param-value>json</param-value>
</init-param>
<init-param>
<param-name>wrapJSONResponses</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>DataSourceLoader</servlet-name>
<servlet-class>com.isomorphic.servlet.DataSourceLoader</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RestHandler</servlet-name>
<url-pattern>/isomorphic/RESTHandler</url-pattern>
</servlet-mapping>
<!-- DataSourceLoader requests -->
<servlet-mapping>
<servlet-name>DataSourceLoader</servlet-name>
<url-pattern>/isomorphic/DataSourceLoader</url-pattern>
</servlet-mapping>
[code]
I am using the smartgwt mobile jar file which creation date is May 10th 2012.
When I try to fetch data I get the following exception:
Code:
16:28:50.906 [ERROR] [plantillaIdeiak] Uncaught exception escaped java.lang.ClassCastException: com.smartgwt.mobile.client.data.Record cannot be cast to com.smartgwt.mobile.client.data.DataSourceField at com.smartgwt.mobile.client.data.DataSource.fromConfig(DataSource.java:1580) at com.smartgwt.mobile.client.data.DataSource$2.onResponseReceived(DataSource.java:1547) at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287) at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) at java.lang.Thread.run(Unknown Source)
Could please tell me if I am using the datasource load correctly and if its a bug, o otherwise I am doing something wrong?
Thanks in advance,
Pablo
Comment