PDA

View Full Version : [FIXED] Combobox.getValue() bug?



richard.hallier
2 Sep 2008, 6:48 AM
Code example below



final RpcProxy<ListLoadConfig, ListLoadResult<Propriete>> proxy = ...
final ListLoader<ListLoadConfig> loader = new ...
final ListStore<BeanModel> store = new ...

final Combobox<BeanModel> cb = new ...
cb.setStore(store);
...
BeanModel v = ... // Init value for the combobox
cb.setValue(v);

RENDERING NOW...
Now when rendering occurs, everything is ok, the combobox is well displayed and init value selected.

The problem appears when we do :


cb.getValue()
Without user clicking on the combobox, the returned value is NULL !
I guess it's because the store is not still loaded.

But if I want to take advantage of the lazy loading of the store (when the user doesn't click the combobox), is it possible to provide the correct initial value (that passed to the setValue method) ? By detecting the store was not loaded?

Cheers
Richard

darrellmeyer
2 Sep 2008, 4:42 PM
I have changed the code. If you are using lazy rendering and the list has not been initialized, the current value will be returned. The change is in SVN.

ziman200
28 Oct 2008, 3:03 AM
If set
select.setHideTrigger(true);
select.setLazyRender(true);
select.setPageSize(LoadingConfig.PAGE_SIZE);

fail with NPE in
ComboBox line 1012

if (!lazyRender) {
RootPanel.get().add(list);
RootPanel.get().remove(list); //REMOVE ELEMENT
initialized = true;
}

if (pageSize > 0) {
footer = list.el().createChild("<div class='" + style + "'></div>"); // TRY GET ELEMENT NULL

(:|