PDA

View Full Version : possible issue on combobox get value



fother
7 Jul 2009, 11:10 AM
the combobox paging size its equals 1 to understand better the problem..

select the first item..
click in the button get value.. will print the value - its ok

go to the page 2
click out of the combo box to dont select the item..
the item select dont change..

now click in the button to get the value will return null



public void onModuleLoad() {

final ExampleServiceAsync service = (ExampleServiceAsync) GWT.create(ExampleService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) service;
String moduleRelativeURL = "service";
endpoint.setServiceEntryPoint(moduleRelativeURL);

// combo
RpcProxy<PagingLoadResult<BeanPost>> proxy = new RpcProxy<PagingLoadResult<BeanPost>>() {
@Override
public void load(Object loadConfig, AsyncCallback<PagingLoadResult<BeanPost>> callback) {
service.getBeanPosts((PagingLoadConfig) loadConfig, callback);
}
};

// loader
final BasePagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy,
new BeanModelReader());
loader.setRemoteSort(true);

ListStore<BeanModel> store = new ListStore<BeanModel>(loader);

final ComboBox<BeanModel> combo = new ComboBox<BeanModel>();
combo.setWidth(580);
combo.setDisplayField("username");
combo.setStore(store);
combo.setPageSize(1);
combo.setMinChars(1);
combo.setTriggerAction(TriggerAction.ALL);

Button btn = new Button("get value", new SelectionListener<ButtonEvent>() {

@Override
public void componentSelected(ButtonEvent ce) {

BeanModel value = combo.getValue();
System.out.println(value);

}
});

RootPanel.get().add(combo);
RootPanel.get().add(btn);
}

fother
8 Jul 2009, 3:43 AM
I can use a memory proxy to solve this..
but I think that isnt the better solution.. because all data will saved in memory proxy..