How do I use ComboBox in EXT-GWT with static data. For example I just want to hard code (for demo purposes) list of First Names and display it to the user. I don't want to use any dummy objects that they are using in their samples. Where can I find simple example with Strings?
Asked
Active
Viewed 1.9k times
2 Answers
2
Here is the code I use in my project:
SimpleComboBox combo = new SimpleComboBox();
combo.add("One");
combo.add("Two");
combo.add("Three");
combo.setSimpleValue("Two");

KevMo
- 5,590
- 13
- 57
- 70
1
Maksim,
I am not sure whether it helps you or not. It was based on the GWT-EXT for combobox. As I remember that, it wraps the String[] with SimpleStore object.
//create a Store using local array data
final Store store = new SimpleStore(new String[]{"abbr", "state", "nick"}, getStates());
store.load();
final ComboBox cb = new ComboBox();
cb.setForceSelection(true);
cb.setMinChars(1);
cb.setFieldLabel("State");
cb.setStore(store);
cb.setDisplayField("state");
cb.setMode(ComboBox.LOCAL);
cb.setTriggerAction(ComboBox.ALL);
cb.setEmptyText("Enter state");
cb.setLoadingText("Searching...");
cb.setTypeAhead(true);
cb.setSelectOnFocus(true);
cb.setWidth(200);
I hope it helps. Tiger
ps) Did you try this example ?
// create store
ListStore<String> store = new ListStore<String>();
store.add( Arrays.asList( new String[]{"A","B","C"}));
ComboBox cb = new ComboBox();
cb.setStore(store);

Tiger
- 507
- 1
- 6
- 16
-
Thanks for your response. There is something is wrong with SimpleStore object. It does not exist. I think it is no longer exist in this library. – Maksim Jul 22 '09 at 00:26
-
I believe that the ComboBox in Ext-GWT API has setStore(ListStore) function to load data. so we can use as below:(It might be the same as the demo example ) // create store ListStore
store = new ListStore – Tiger Jul 22 '09 at 04:53(); store.add( Arrays.asList( new String[]{"A","B","C"})); ComboBox cb = new ComboBox(); cb.setStore(store); I hope it helps. -
Now it complains about String in "ListStore
", here is error "Bound mismatch: The type String is not a valid substitute for the bounded parameter – Maksim Jul 22 '09 at 15:26of the type ListStore "