Revision history [back]

click to hide/show revision 1
initial version

asked 2015-03-03 06:52:49 +0800

wangzeyou gravatar image wangzeyou

How to clear display value when clear combox's items

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
    }

How to clear display value when clear combox's items

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
    }
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More