javierdotnet / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 3 forks source link

Calling setValue() on a combobox with delay loaded data doesn't work #442

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Take a Combobox
2. Load data for that combobox using an RPC call that takes a little while,
say one second
3. After the data is loaded, try calling setValue() on the combobox. The
item you called setValue() with is selected, but you can no longer see any
of the other values in the combobox.

Here is some sample code:

`
final ComboBox myCombo = new ComboBox("Users");

myCombo.setTypeAhead(false);
myCombo.setEditable(false);
myCombo.setMode(ComboBox.LOCAL);
myCombo.setWidth(225);
myCombo.setValueField("value");
myCombo.setDisplayField("name");

final Store userStore = new Store(new ArrayReader(new RecordDef(new FieldDef[]{
   new StringFieldDef("name"),
   new StringFieldDef("value")
})));

userStore.addStoreListener(new StoreListenerAdapter() {
   public void onDataChanged(Store store) {
      myCombo.setValue("0");
   }
});

myCombo.setStore(userStore);

Timer timer = new Timer() {
   public void run() {
      userStore.setDataProxy(new MemoryProxy(new Object[][]{
                 new Object[]{"User 1", "0"},
                 new Object[]{"User 2", "1"},
                 new Object[]{"User 3", "2"},
                 new Object[]{"User 4", "3"},
                 new Object[]{"User 5", "4"},
                 new Object[]{"User 6", "5"}
                }));
                userStore.load();
            }
        };

timer.schedule(1000);

com.gwtext.client.widgets.Panel p = new com.gwtext.client.widgets.Panel();
FormPanel myForm = new FormPanel("MyForm");
myForm.add(myCombo);
p.add(myForm);

RootPanel.get().add(p);
`

The above code will add the users to the box and select "User 1," but then
the combobox cannot be changed. Only "User 1" is shown in the dropdown.
Taking out the setValue in the store listener causes the dropdown to work
correctly, except nothing is selected when the box is first loaded.

What is the expected output? What do you see instead?

I expect when I click the dropdown button next to the combobox I should see
all my values. Instead, I only see the value that I set with setValue()

What version of the product are you using? On what operating system?

GWT EXT 2.0.5
GWT 1.5 RC1 or 1.5.2

Please provide any additional information below.

Original issue reported on code.google.com by lau...@gmail.com on 17 Oct 2008 at 5:29

GoogleCodeExporter commented 9 years ago
I have exactly the same problem. Any solution/workaround found ?

Original comment by mail.tho...@gmail.com on 14 Jan 2009 at 8:32

GoogleCodeExporter commented 9 years ago
Try to set combobox's setTriggerAction(ComboBox.ALL) method:

myCombo.setTriggerAction(ComboBox.ALL);

Original comment by rimma...@gmail.com on 28 Jan 2009 at 8:58