-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
Hi, I'm using ZK 7.0.3 MVVM and after I clear the combobox's items, sure that there's no comboitem under the combobox, but the value still displayed on the combobox. How can I clear the display value in the combobox? Do I have to wire the ComboBox on the zul to clear the display value?
<row>
<combobox model="@bind(vm.tempList)"
selectedItem="@bind(vm.selectedItem)" readonly="true">
<template name="model" var="each">
<comboitem label="@load(each)"/>
</template>
</combobox>
</row>
<row>
<button label="clear" onClick="@command('clear')"/>
</row>
//IN THE ViewModel:
List<String> tempList = new ArrayList<String>(Arrays.asList("1", "2", "3", "4", "5"));
String selectedItem = tempList.get(0);
// getters and setters
@Command
@NotifyChange({"tempList", "selectedItem"})
public void clear()
{
tempList.clear();
selectedItem = null; // <--- clear selection, but still displayed on combobox
}
2 | No.2 Revision |
Hi, I'm using ZK 7.0.3 MVVM and after I clear the combobox's items, sure that there's no comboitem under the combobox, but the value still displayed on the combobox.
How can I clear the display value in the combobox?
combobox?
Do I have to wire the ComboBox on the zul to clear the display value?
<row>
<combobox model="@bind(vm.tempList)"
selectedItem="@bind(vm.selectedItem)" readonly="true">
<template name="model" var="each">
<comboitem label="@load(each)"/>
</template>
</combobox>
</row>
<row>
<button label="clear" onClick="@command('clear')"/>
</row>
//IN THE ViewModel:
List<String> tempList = new ArrayList<String>(Arrays.asList("1", "2", "3", "4", "5"));
String selectedItem = tempList.get(0);
// getters and setters
@Command
@NotifyChange({"tempList", "selectedItem"})
public void clear()
{
tempList.clear();
selectedItem = null; // <--- clear selection, but still displayed on combobox
}