Reputation: 113
I built a web portal with zk. I have some data and I want to show them. I made this:
<div class="row-fluid">
</div>
<hbox style="margin-top:20px">
<vbox>
<div>
<textbox value="@bind(vm.uname)"/>
<datebox id="in" value = "@bind(vm.date1)"/>
<datebox id="in1" value = "@bind(vm.date2)"/>
<button onClick="@command('searchValue')" label="Cerca" disabled="@load(empty vm.uname)" />
</div>
<listbox height="260px" model="@bind(vm.value)" emptyMessage="Nessun risultato presente"
selectedItem="@bind(vm.userSelected)">
<listhead>
<listheader label="Date" />
<listheader label="Hour" />
<listheader label="Value (bpm)"/>
</listhead>
<template name="model">
<listitem>
<listcell label="@bind(each.date)"></listcell>
<listcell label="@bind(each.min)"></listcell>
<listcell label="@bind(each.value)" ></listcell>
</listitem>
</template>
</listbox>
</vbox>
</hbox>
<charts id="chart2" type="line"
title="Dati"/>
Well, I have 3 textbox (1 textbox and 2 datebox exactely). when I insert data in these 3 textbox it appened that application call method searchValue (that works correctely). This method search data in an ArrayList that is initialized automatically.
Now I want to change. I want that value vm.uname is not passed but is hidden and equals to ${empty execution.userPrincipal.name? 'anonimo' : execution.userPrincipal.name }
If I did this:
<textbox value="${empty execution.userPrincipal.name?
'anonimo' : execution.userPrincipal.name }"/>
<datebox id="in" value = "@bind(vm.date1)"/>
<datebox id="in1" value = "@bind(vm.date2)"/>
<button onClick="@command('searchValue')" label="Cerca" disabled="@load(empty vm.uname)" />
</div>
It happened that the value appears correctely but for example button is always disabled. How can I resolve it?
In searchValue must arrive vm.uname value!
Upvotes: 1
Views: 398
Reputation: 41
DISCLAIMER: This should be a comment, but I don't have enough reputation. Sorry for that.
The button "Cerca" is disabled because in your second snippet there's no binding for vm.uname and so it will never be set to something "not empty" in the View Model.
Moreover, I can't understand the purpose of that "disabled": after the change you made, the username in the search is a value coming from execution or a default value; do you still need to disable that button?
Maybe you should show some relevant part of your view model to get more help.
Upvotes: 1