Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Nov 2009
    Posts
    15
    Vote Rating
    0
    ljohnston is on a distinguished road

      0  

    Default [FIXED][GXT 2.1.0] ComboBox and Store Update Problem

    [FIXED][GXT 2.1.0] ComboBox and Store Update Problem


    I believe I've encountered a problem when updating a ComboBox's store.

    I've got two ComboBoxes. Both ComboBoxes share the same store.

    In another part of my application, I update one of the objects that's held onto by the store, and then call store.update() on the modified object.

    If neither ComboBox has the modified object currently selected, things work as expected: each ComboBox shows the list with the modified record properly updated.

    If the modified object is selected in one of the ComboBoxes, however, then the behavior is seemingly incorrect:
    • The ComboBox that had the modified object selected will still show the original value, rather than the updated value. In addition, it will no longer show the drop down. Clicking off this ComboBox will then show the validation error decorations, and indicate that this field is required.
    • The ComboBox that had another value selected, will appear to be correct (i.e. the list will show all values with the updated object properly shown), unless you click on the other ComboBox first. Once the other ComboBox is selected, returning to this ComboBox will show a dropdown list with only a single value - the one that it had selected when the store was updated.
    Is this a bug or am I just doing something wrong?

    My expectations would be as follows:
    • The ComboBox with the updated object selected should update the selected value in the display and the dropdown when the store is updated.
    • The ComboBox without the updated object selected should simply update the list to reflect the object's modifications.
    • Both dropdowns should continue to show all objects in the store.
    - GXT Version: 2.1.0
    - Behavior occurs in both Hosted and Web modes.
    - Browser: FireFox 3.5.3
    - Operating System: Mac OS X 10.6

    I've included a test case below. To exhibit the behavior, select "orig1" in the first ComboBox and anything other than "orig1" in the second ComboBox and click the button. The value in the first ComboBox will remain as it was rather than showing the new value. If you then click on the second ComboBox you will see that it appears correctly. Then select the first ComboBox and you will see that the dropdown will no longer display. Go back to the second ComboBox and the dropdown will only have a single value.

    Code:
    import com.extjs.gxt.ui.client.data.BaseModel;
    import com.extjs.gxt.ui.client.event.ButtonEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.store.ListStore;
    import com.extjs.gxt.ui.client.widget.button.Button;
    import com.extjs.gxt.ui.client.widget.form.ComboBox;
    import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
    import com.extjs.gxt.ui.client.widget.form.FormPanel;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootPanel;
    import java.util.ArrayList;
    import java.util.List;
    
    
    public class Test implements EntryPoint {
    
      public void onModuleLoad() {
        
        final ComboBox combo1 = new ComboBox<MyModel>();
        combo1.setFieldLabel("Combo 1");
        combo1.setDisplayField("name");
        combo1.setEditable(false);
        combo1.setForceSelection(true);
        combo1.setTriggerAction(TriggerAction.ALL);
    
        final ComboBox combo2 = new ComboBox<MyModel>();
        combo2.setFieldLabel("Combo 2");
        combo2.setDisplayField("name");
        combo2.setEditable(false);
        combo2.setForceSelection(true);
        combo2.setTriggerAction(TriggerAction.ALL);
    
        final ListStore<MyModel> store = new ListStore<MyModel>();
    
        combo1.setStore(store);
        combo2.setStore(store);
    
        // Has no effect...
        //combo1.getListView().setStore(store);
        //combo2.getListView().setStore(store);
    
        List<MyModel> models = getModels();
        store.add(models);
    
        final MyModel m = models.get(0);
    
        final Button button = new Button("Button");
        button.addSelectionListener(new SelectionListener<ButtonEvent>() {
          public void componentSelected(ButtonEvent ce)
          {
            m.setName("newName");
            store.update(m);
            combo1.getListView().refresh();
            combo2.getListView().refresh();
          }
        });
    
        FormPanel fp = new FormPanel();
        fp.add(combo1);
        fp.add(combo2);
        fp.add(button);
    
        RootPanel.get().add(fp);
      }
    
      List<MyModel> getModels() {
        List<MyModel> models = new ArrayList<MyModel>();
    
        models.add(new MyModel("orig1"));
        models.add(new MyModel("orig2"));
        models.add(new MyModel("orig3"));
        models.add(new MyModel("orig4"));
        models.add(new MyModel("orig5"));
        
        return models;
      }
    
      private static class MyModel extends BaseModel {
    
        MyModel(String name) {
          setName(name);
        }
    
        String getName() {
          return get("name");
        }
    
        void setName(String name) {
          set("name", name);
        }
      }
    }

  2. #2
    Ext User
    Join Date
    Nov 2009
    Posts
    15
    Vote Rating
    0
    ljohnston is on a distinguished road

      0  

    Default


    Ignoring it isn't gonna make it go away...

  3. #3
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    This bug is fixed in the releases/2.1 branch and is now available in the 2.1.1-beta release available here. Please validate the fix.

  4. #4
    Ext User
    Join Date
    Nov 2009
    Posts
    15
    Vote Rating
    0
    ljohnston is on a distinguished road

      0  

    Default


    Just tested this with 2.1.1-beta and the issue is resolved. Thanks.

Thread Participants: 1