2
我有一个GXT ComboBox
这是绑定到ListStore
并有一个addSelectionHandler
被称为哪些工作正常。我也使用了combo.setEmptyText("Select an item..")
。GXT ComboBox选择后取消选择
但是,当用户进行选择时,我想让ComboBox
返回到其“no selection”状态。我怎样才能让它显示“选择一个项目..”?
StProperties props = GWT.create(StProperties.class);
ListStore<St> sts = new ListStore<St>(combo.id());
combo = new ComboBox<St>(sts, props.name());
combo.setTypeAhead(true);
combo.setTriggerAction(TriggerAction.ALL);
addHandlersForEventObservation(combo,props.name());
...
combo.addSelectionHandler(new SelectionHandler<T>() {
public void onSelection(SelectionEvent<T> event) {
System.out.println("value selected:"+event.getSelectedItem());
// handle selection
// unselect item in combo here ---
}
});
您是否在您的选择处理程序中尝试了'combo.setValue(null)'? – 2013-03-22 17:58:51
我发现有一个combo.reset(),但没有运气。我会在几天后重新访问时尝试一下您的建议。 – ZimSystem 2013-03-23 14:37:19
无法使用.setValue(null)。我也试过.clear(),.redraw()和这些的各种组合,但没有运气。 – ZimSystem 2013-03-25 16:04:37