Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • 5.1p/6.1p: MultiComboBoxItem with mouse selection bug / stale data issue

    Hi Isomorphic,

    please see this BuiltInDS-based testcase (FF26 Dev mode using v11.1p_2017-11-16).
    It seems that the MultiComboBoxItem is just not working when using the mouse to select entries first. I can see it working though here in the samples, so there must be some difference here.
    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.Version;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.AdvancedCriteria;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.types.MultiComboBoxLayoutStyle;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.Window;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
    import com.smartgwt.client.widgets.form.fields.MultiComboBoxItem;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
        private VLayout mainLayout;
        private IButton recreateBtn;
    
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
    
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            mainLayout = new VLayout(20);
            mainLayout.setWidth100();
            mainLayout.setHeight100();
    
            recreateBtn = new IButton("Recreate");
            recreateBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    recreate();
                }
            });
            mainLayout.addMember(recreateBtn);
            recreate();
            mainLayout.draw();
        }
    
        private void recreate() {
            Window w = new Window();
            w.setWidth("95%");
            w.setHeight("95%");
            w.setMembersMargin(0);
            w.setModalMaskOpacity(70);
            w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
            w.setTitle("MultiComboBoxItem problems with mouse selection" + w.getTitle());
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
    
            final DynamicForm df = new DynamicForm();
            df.setDataSource(DataSource.get("animals"));
    
            df.setHeight(200);
            df.setWidth(500);
            df.setTitleWidth(200);
            df.setAutoFetchData(false);
    
            MultiComboBoxItem mcbiFlow = new MultiComboBoxItem("TEST1");
            mcbiFlow.setOptionDataSource(DataSource.get("animals"));
            mcbiFlow.setTitle("Favorite Animals Flow-MCBI");
            mcbiFlow.setComboBoxProperties(new ComboBoxItemProperties());
            mcbiFlow.setDisplayField("commonName");
            mcbiFlow.setValueField("scientificName");
    
            MultiComboBoxItem mcbiHorizontal = new MultiComboBoxItem("TEST2");
            mcbiHorizontal.setOptionDataSource(DataSource.get("animals"));
            mcbiHorizontal.setTitle("Favorite Animals Horizontal-MCBI");
            mcbiHorizontal.setLayoutStyle(MultiComboBoxLayoutStyle.HORIZONTALREVERSE);
            mcbiHorizontal.setComboBoxProperties(new ComboBoxItemProperties());
            mcbiHorizontal.setDisplayField("commonName");
            mcbiHorizontal.setValueField("scientificName");
    
            MultiComboBoxItem mcbiVertical = new MultiComboBoxItem("TEST3");
            mcbiVertical.setOptionDataSource(DataSource.get("animals"));
            mcbiVertical.setTitle("Favorite Animals Vertical-MCBI");
            mcbiVertical.setLayoutStyle(MultiComboBoxLayoutStyle.VERTICAL);
            mcbiVertical.setComboBoxProperties(new ComboBoxItemProperties());
            mcbiVertical.setDisplayField("commonName");
            mcbiVertical.setValueField("scientificName");
    
            ComboBoxItem testCBI = new ComboBoxItemProperties();
            testCBI.setName("TEST4");
            testCBI.setTitle("Favorite Animals CBI");
            testCBI.setDisplayField("commonName");
            testCBI.setValueField("scientificName");
    
            df.setFields(mcbiFlow, mcbiHorizontal, mcbiVertical, testCBI);
            w.addItem(df);
            w.show();
        }
    
        private class ComboBoxItemProperties extends ComboBoxItem {
            public ComboBoxItemProperties() {
                super();
                setPickListCriteria(new AdvancedCriteria(new Criterion("commonName", OperatorId.GREATER_OR_EQUAL, "M")));
            }
        }
    }
    Video, see that the selection is not working in the beginning, but is working when you enter a letter via keyboard first.
    Also note how the 2nd MCBI is working without a keypress after the 1st MCBI is repaired by a keypress and that this is not the case for the 3rd MCBI.
    Click image for larger version

Name:	MultiComboBoxItem.gif
Views:	1
Size:	278.8 KB
ID:	250585

    It would be great if you could fix this one as I'd really like to use MultiComboBoxItem because it does look good and would a use here here perfectly.

    I also have an additional question/issue:
    Even if I close and repopen the window via my "Recreate" button, I only have one request in the Developer Console the whole time I'm using the different MCBI/CBI in the testcase.
    Is this correct? If so, how can I force a data reload here?

    Best regards
    Blama

  • #2
    Hi Isomorphic,

    did you already have a look at this one? Currently the MultiComboBoxItem is unusable for me.

    Thank you & Best regards
    Blama

    Comment


    • #3
      Hi Blama
      Sorry for the silence on this - we have been looking at it, but failed to update the thread. We don't yet have a solution but will follow up when we do

      Regards
      Isomorphic Software

      Comment


      • #4
        We've now made a change which should address this issue in 5.1p and 6.1p. The issue had already been resolved in 12.0d

        This change should be present in the next nightly build (Dec 12 or above). Please let us know if the problem persists for you.

        Regards
        Isomorphic Software

        Comment


        • #5
          Hi Isomorphic,

          I can see that this is working using v11.1p_2017-12-27. I'll also retry in my application.
          Can you also elaborate on how caching works here and how I can force a refresh?

          Use case is that I want to offer a list of users. Selected users will be added to a related DataSource after a "OK"-click (not included in the sample) and should not be in the list anymore afterwards (=after window reopen).
          In the sample I'm getting only one fetch in total for all the four FormItems and also no new fetch after I close and reopen the window via the "Recreate"-button.

          Best regards
          Blama

          Comment


          • #6
            The pickList contains a ResultSet which listens for cache updates just like other ResultSets, so it would be affected if you used dataSource.updateCaches() to broadcast the changes (this assumes that the pickList has criteria applied that would cause the updated records to be removed).

            Comment


            • #7
              Hi Isomorphic,

              I won't be sending cache updates with the DSResponse of the OK click - this seems way to unrelated.
              I just want that the FormItem (SelectItem, ComboBoxItem, MultiComboBoxItem) sends a request every time and does not rely on cached data.
              I'm not sure here if I also don't want clientside filtering for ComboBoxItem, but I definitely want a fetch the first time a newly created pickList is shown.
              IMHO there must be some setting on FormItem to enforce this.

              Having a look at the docs again (don't know how I missed those), it seems like SelectItem.setCachePickListResults() and ComboBoxItem.setCachePickListResults() should solve this. I'll try this and post back here.

              Best regards
              Blama

              Comment

              Working...
              X