I have two different selectItems which fetch data from the same datasource, but something is not working:
table.ds.xml
When you press the button, only one of the selectItems is correctly set (the second one, while the first one remains empty), and you get this error:
Using SmartGWT Power (v9.1p_2014-09-06/PowerEdition Deployment (built 2014-09-06)) with MSSQL 2014.
Code:
public void onModuleLoad() { DynamicForm df1 = new DynamicForm(); final SelectItem field1 = new SelectItem(); field1.setValueField("f_schueler_id"); field1.setDisplayField("f_name"); field1.setAutoFetchData(false); field1.setOptionDataSource(DataSource.get("table")); df1.setFields(field1); DynamicForm df2 = new DynamicForm(); final SelectItem field2 = new SelectItem(); field2.setValueField("f_schueler_id"); field2.setDisplayField("f_name"); field2.setAutoFetchData(false); field2.setOptionDataSource(DataSource.get("table")); df2.setItems(field2); VLayout vlayout = new VLayout(); vlayout.addMember(df1); vlayout.addMember(df2); IButton button = new IButton("Click me"); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { field1.fetchData(new DSCallback() { @Override public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) { if (dsResponse.getData().length >= 1) { field1.setValue(dsResponse.getData()[0] .getAttributeAsInt("f_schueler_id")); } } }); field2.fetchData(new DSCallback() { @Override public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) { if (dsResponse.getData().length >= 2) { field2.setValue(dsResponse.getData()[1] .getAttributeAsInt("f_schueler_id")); } } }); } }); vlayout.addMember(button); vlayout.draw(); }
Code:
<DataSource ID="table" serverType="sql" tableName="t_schueler" > <fields> <field name="f_schueler_id" type="sequence" primaryKey="true" /> <field name="f_name" type="text" required="true" /> </fields> </DataSource>
Code:
17:40:59.991 [ERROR] [zedes2V010214] 17:41:00.003:XRP3:WARN:The ResultSet's cache was invalidated while the following request was outstanding: {operationType: "fetch", dataSource: "table", data: Obj, callback: Obj, requestId: "table$6270", useStrictJSON: null, fallbackToEval: false, textMatchStyle: "startsWith", operationId: undef, startRow: 0, endRow: 75, sortBy: undef, resultSet: [ResultSet ID:isc_ResultSet_0 (created by: isc_PickListMenu_0)], componentId: "isc_PickListMenu_0", componentContext: "isc_DynamicForm_0.isc_SelectItem_0", showPrompt: false, internalClientContext: Obj, afterFlowCallback: Obj, operation: Obj{ID:table_fetch}, prompt: "Suche Datensätze die den Kriterien entsp..."[49], willHandleError: true, lastClientEventThreadCode: "MUP6", parentNode: null, bypassCache: true, unconvertedDSRequest: Obj, jsonReviver: DataSource.jsonReviver(), oldValues: Obj}, request data:{}:isc_ResultSet_0 (created by: isc_PickListMenu_0):[object Object] com.smartgwt.client.core.JsObject$SGWT_WARN: 17:41:00.003:XRP3:WARN:The ResultSet's cache was invalidated while the following request was outstanding: {operationType: "fetch", dataSource: "table", data: Obj, callback: Obj, requestId: "table$6270", useStrictJSON: null, fallbackToEval: false, textMatchStyle: "startsWith", operationId: undef, startRow: 0, endRow: 75, sortBy: undef, resultSet: [ResultSet ID:isc_ResultSet_0 (created by: isc_PickListMenu_0)], componentId: "isc_PickListMenu_0", componentContext: "isc_DynamicForm_0.isc_SelectItem_0", showPrompt: false, internalClientContext: Obj, afterFlowCallback: Obj, operation: Obj{ID:table_fetch}, prompt: "Suche Datensätze die den Kriterien entsp..."[49], willHandleError: true, lastClientEventThreadCode: "MUP6", parentNode: null, bypassCache: true, unconvertedDSRequest: Obj, jsonReviver: DataSource.jsonReviver(), oldValues: Obj}, request data:{}:isc_ResultSet_0 (created by: isc_PickListMenu_0):[object Object] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105) 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:293) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Thread.java:745)
Comment