Stack Exchange
How to repopulate a GXT ComboBox on each click?
I'm using a simple ComboBox in GXT that gets its values from the database.
What I want is that everytime that the user clicks (expands) the ComboBox, it will check and re-populate it with the latest entries in the database (in case they've changed).
Right now I'm doing something like:
ProtocolProperties protocolProperties = GWT.create(ProtocolProperties.class);
final ListStore<ProtocolDto> protocolStore = new ListStore<ProtocolDto>(protocolProperties.id());

protocol = new ComboBox<ProtocolDto>(protocolStore, protocolProperties.name());

    protocol.addExpandHandler(new ExpandHandler() {
                @Override
                public void onExpand(ExpandEvent event) {
                    protocolStore.clear();

                    ProtocolDto emptyDto = new ProtocolDto();
                    emptyDto.setId(-1);
                    emptyDto.setName("None");
                    protocolStore.add(emptyDto);

                    AppEntryPoint.getLogbookdataservice().getAllProtocols(new AsyncCallback<List<ProtocolDto>>() {

                        @Override
                        public void onSuccess(List<ProtocolDto> result) {               
                            protocolStore.addAll(result);
                        }

                        @Override
                        public void onFailure(Throwable caught) {
                            // TODO Auto-generated method stub

                        }
                    });
                }
            });

Thanks to anyone who takes the time to answer this.

Are you having a problem with your current method or the code example you've provided?

You should be looking at Async Support in Combobox instead of reinventing a square wheel.
Sencha Demo - http://www.sencha.com/examples/#ExamplePlace:advancedcombobox
Stackoverflow - Also one approach discussed here - Dynamic Autosuggest Combobox in GXT
GXT Forum - http://www.sencha.com/forum/showthread.php?185967-ComboBox-doQuery-method-seems-not-working-with-Remote-Loader

To be fair, reinventing the wheel isn't a terrible idea to learn how the wheel works, but referring to existing (and working!) wheels is still useful.
