Question

I'm trying to make a filter with a datebox. When no date is inserted, this will not be added to the query. When date is inserted, he counts from this date on.

This works all very good, the only stupid little problem I have is that I have a button for clearing the date. Or I do with @command(...) and set mine queryObject.date to null, witch will renew mine search correct BUT the date is still in the datebox. (I don't want to use autowired for the datebox)

Or I do searchBeginDate.setText(null) and the text is gone but mine list doesn't refresh.

What option I have to do the both?

edit : sample code of project.

 <datebox id="searchBeginDate" value="@bind(vm.loggingVmQueryObject.beginDate)" onOK="@command('filter')" />
 <button onClick="searchBeginDate.setText(null);vm.loggingVmQueryObject.setBeginDate(null)"  image="/img/delete.PNG" />

This do the whiping of the datebox but the list isn't refreshed.

<datebox id="searchBeginDate" value="@bind(vm.loggingVmQueryObject.beginDate)" onOK="@command('filter')" />
<button onClick="@command('clearBeginDate')"  image="/img/delete.PNG" />

This refresh the list correct, in code the loggingVmQueryObject.beginDate is set to null but the datebox is still showing last date set.

Greetz chill.

Was it helpful?

Solution

You show me the code, I show a solution ;)

in zul

<datebox id="searchBeginDate" value="@bind(vm.loggingVmQueryObject.beginDate)" onOK="@command('filter')" />
<button onClick="@command('clearBeginDate', date = searchBeginDate)"  image="/img/delete.PNG" />

in java

public void clearBeginDate(@BindingParam("date")Datebox date){
//your other code here
date.setText(null);

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top