Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

MultiComboBoxItem uncaught exception with OptionDataSource

$
0
0
PROBLEM
I have used test/client only datasources successfully (no errors), but when I use an SQL datasource, I get the Javascript error below.

To reproduce,

1) I chose two items in the first MultiComboBoxItem.
2) I copied them to the second MultiComboBoxItem with the copy button.
3) I removed an item in the second MultiComboBoxItem.
4) I tried to copy the first to the second MultiComboBoxItem again with the copy button.
5) Then I get a Javascript error.

Setup

1. Smart GWT 4.1p built for SmartClient version v9.1p_2014-06-30

2. Firefox

5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)

Code:

Uncaught exception: com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) @com.smartgwt.client.widgets.form.fields.MultiComboBoxItem::setValues([Ljava/lang/Object;)([Java object: [Ljava.lang.String;@1005209717]): _2 is null
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
    at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:487)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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:338)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
    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:347)
    at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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: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:744)
Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.widgets.form.fields.MultiComboBoxItem::setValues([Ljava/lang/Object;)([Java object: [Ljava.lang.String;@1005209717]): _2 is null
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.smartgwt.client.widgets.form.fields.MultiComboBoxItem.setValues(MultiComboBoxItem.java)
    at com.fcm.portfolio.client.Portfolio$1.onClick(Portfolio.java:83)
    at com.smartgwt.client.widgets.form.fields.events.ClickEvent.dispatch(ClickEvent.java:111)
    at com.smartgwt.client.widgets.form.fields.events.ClickEvent.dispatch(ClickEvent.java:1)
    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
    at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
    at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
    at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
    at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:487)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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:338)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
    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:347)
    at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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: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:744)

6. Here's my sample code:

Code:

                final MultiComboBoxItem A = new MultiComboBoxItem("First");
                A.setWidth(100);
                A.setMultiple(true);
                A.setLayoutStyle(MultiComboBoxLayoutStyle.HORIZONTALREVERSE);
                A.setOptionDataSource(DataSource.get("brokerdealers1"));
                A.setDisplayField("bdcode");
                A.setValueField("bdcode");
                A.setAutoFetchData(true);

                final MultiComboBoxItem B = new MultiComboBoxItem("Second");
                B.setWidth(100);
                B.setMultiple(true);
                B.setLayoutStyle(MultiComboBoxLayoutStyle.HORIZONTALREVERSE);
                B.setOptionDataSource(DataSource.get("brokerdealers2"));
                B.setDisplayField("bdcode");
                B.setValueField("bdcode");
                B.setAutoFetchData(true);

                ButtonItem bt = new ButtonItem("Copy");
                bt.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {

                        @Override
                        public void onClick(
                                        com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
                                B.setValues((Object []) A.getValues());
                               
                        }
                       
                });
               
                DynamicForm h = new DynamicForm();
                h.setFields(A,B,bt);

                Canvas c = new Canvas();
                c.addChild(h);

Here's datasource for the first. The second is almost identical except for the ID.
Code:

<DataSource
  tableName="brokerdealers"
  ID="brokerdealers1"
  dataSourceVersion="1"
  serverType="sql"
  autoDeriveSchema="true"
  >
  <fields>
            <field name="bdid"            type="sequence"        primaryKey="true" canEdit="false"></field>         
  </fields>

  <operationBindings>
        <operationBinding operationType="fetch">
                <orderClause>
                        bdcode asc
                </orderClause>
        </operationBinding>
               
  </operationBindings>
</DataSource>


Viewing all articles
Browse latest Browse all 4756

Trending Articles