Hi there,
I have created a subClass of ComboBox which uses a proxy, a loader and a PagingToolBar. The ComboBox is used to select numeric codes. When a user types in, say, "12" a service goes to the server and retrieves all codes starting in "12" depending on another condition, i.e. the clients associated to the ites whose value starts with "12". Now the user change this condition and then again type "12" in the combo box expecting to retrieve all the numeric codes starting in "12" for the new condition.
The problem I am having is that, having already typed "12" in the combo box, when I type "12" again, the combo box does not call the service again and hence show me the numeric codes for the first condition, not the ones for the second, new, condition. There is a caching mechanism that I would like to override when the condition changes. I am pretty sure it is as easy as calling a method or setting a property somewhere, but I don't know where.
Any ideas? Thanks for your help,
Francesco
Below is my code for reference.
Code:
public class ClienteComboBox extends ComboBox<ClientBmd>{
private MyService myService = (MyService)GWT.create(MyService.class) ;
private static ListStore<ClientBmd> clientsStore;
private static PagingLoader<PagingLoadResult<ClientBmd>> loader;
private static ApplicationModel applicationModel;
private static PagingToolBar pagingBar;
private static final int pageSize = 10;
private static final String toolTipText = "A Tooltip";
public ClienteComboBox() {
applicationModel = ApplicationModel.getInstance();
addSelectionChangedListener(new SelectionChangedListener<ClientBmd>(){
@Override
public void selectionChanged(SelectionChangedEvent<ClientBmd> se) {
applicationModel.setClient(se.getSelectedItem().getClient(), true);
}
});
RpcProxy<PagingLoadResult<ClientBmd>> proxy = new RpcProxy<PagingLoadResult<ClientBmd>>() {
@Override
protected void load(Object loadConfig, AsyncCallback<PagingLoadResult<ClientBmd>> callback) {
myService.getClientBmds(applicationModel.getBankers(),(PagingLoadConfig)loadConfig,callback);
}
};
loader = new BasePagingLoader<PagingLoadResult<ClientBmd>>(proxy);
loader.setRemoteSort(false);
loader.setSortField("clientName");
pagingBar = new PagingToolBar(pageSize);
pagingBar.bind(loader);
clientsStore = new ListStore<ClientBmd>(loader);
setToolTip(toolTipText);
setHideTrigger(true);
setForceSelection(true);
setTriggerAction(TriggerAction.ALL);
setDisplayField("clientName");
setStore(clientsStore);
setTypeAhead(true);
setPageSize(pageSize);
setMinChars(1);
setFieldLabel("Clienti");
}
}