Revision history [back]

click to hide/show revision 1
initial version

asked 2019-02-18 14:29:35 +0800

pavelEW gravatar image pavelEW

"Clear" button for combobox

Hi guys :)

I want to add a "clear" button to my comboboxes which will clear the selected value in it and in form.

It's easy to do this when you know what value will be cleared. But in my case I have few search forms with 3-5 comboboxes there. All values are beaing stored to a search bean - simple POJO.

<div form="@id('fx') @load(vm.orderLookup) @save(vm.orderLookup, before='onSearch')">

I've tried to pass a combobox component to my @Command method and set selected value to null there, but it doesn't affect value in proxy form somehow.

Here is my combobox, it is used as template and on search form I only apply those templates with needed parameters:

<zk xmlns="I'm sorry I can't publish links :(">
<n:div class="form-group">
    <label sclass="control-label ox-field-label-transparent" value="@load(label)"/>
    <combobox selectedItem="@bind(selectedItem)" model="@init(model)">
        <template name="model" var="p">
            <comboitem value="@load(p.uid)" label="@load(p.proxy)"/>
        </template>
    </combobox>
    <n:div class="input-group">
        <n:span class="input-group-btn">
            <h:a class="btn btn-sm btn-default fa fa-times-circle close" type="button" style="border:none"/>
        </n:span>
    </n:div>
</n:div>

</zk>

Any ideas on how it could be done?

"Clear" button for combobox

Hi guys :)

I want to add a "clear" button to my comboboxes which will clear the selected value in it and in a form.

It's easy to do this when you know what value will be cleared. But in my case I have few search forms with 3-5 comboboxes there. All values are beaing stored to a search bean - simple POJO.

<div form="@id('fx') @load(vm.orderLookup) @save(vm.orderLookup, before='onSearch')">

I've tried to pass a combobox component to my @Command method and set selected value to null there, but it doesn't affect value in proxy form somehow.

Here is my combobox, it is used as template and on search form I only apply those templates with needed parameters:

<zk xmlns="I'm sorry I can't publish links :(">
<n:div class="form-group">
    <label sclass="control-label ox-field-label-transparent" value="@load(label)"/>
    <combobox selectedItem="@bind(selectedItem)" model="@init(model)">
        <template name="model" var="p">
            <comboitem value="@load(p.uid)" label="@load(p.proxy)"/>
        </template>
    </combobox>
    <n:div class="input-group">
        <n:span class="input-group-btn">
            <h:a class="btn btn-sm btn-default fa fa-times-circle close" type="button" style="border:none"/>
        </n:span>
    </n:div>
</n:div>

</zk>

Any ideas on how it could be done?

"Clear" button for combobox

Hi guys :)

I want to add a "clear" button to my comboboxes which will clear the selected value in it and in a form.

It's easy to do this when you know what value will be cleared. But in my case I have few search forms with 3-5 comboboxes there. All values are beaing stored to a search bean - simple POJO.

<div form="@id('fx') @load(vm.orderLookup) @save(vm.orderLookup, before='onSearch')">

I've tried to pass a combobox component to my @Command method and set selected value to null there, but it doesn't affect value in proxy form somehow.

Here is my combobox, it is used as template and on search form I only apply those templates with needed parameters:

<zk xmlns="I'm sorry I can't publish links :(">
<n:div class="form-group">
    <label sclass="control-label ox-field-label-transparent" value="@load(label)"/>
    <combobox selectedItem="@bind(selectedItem)" model="@init(model)">
        <template name="model" var="p">
            <comboitem value="@load(p.uid)" label="@load(p.proxy)"/>
        </template>
    </combobox>
    <n:div class="input-group">
        <n:span class="input-group-btn">
            <h:a class="btn btn-sm btn-default fa fa-times-circle close" type="button" style="border:none"/>
        </n:span>
    </n:div>
</n:div>
</zk>

</zk>

Any ideas on how it could be done?

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More