0

Combobox, databinding and autodrop

asked 2010-11-10 15:06:15 +0800

gaiol gravatar image gaiol
20 2
http://www.bgserviceit.be

updated 2010-11-10 15:15:49 +0800

Hello,

First, sorry for my english, I'm belgian.

ZK version : 5.0.1 (maven)
explorer : chrome

I have a combobox with autodrop filled by databinding. I want to fill the list only after the second character in the box (big list in DB). So, when I put one character in the box, the autodrop open a empty list. When I put the second character, the databinding runs and fill the list. The problem comes here, the list has more than one result but the list size doesn't change (one result) and another arrow appears. like that. How could I refresh the list's size ?

This is the relevant part of my controller :

public void onChanging$villeCB(InputEvent evt) {
try {
String search = evt.getValue().replace(" ", "");
if (search.length() >= 2) {
modelVille = new ArrayList<Ville>();
List<Ville> listVille = villeManager.findLike(search + "*");
if (listVille != null && listVille.size() > 0) {
modelVille.addAll(listVille);
}
}
} catch (WrongValueException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
}


And the zul :

<combobox id="villeCB" model="@{mainCtrl.modelVille, load-after='self.onChanging'}"
selectedItem="@{mainCtrl.selectedVille}" cols="50">
<comboitem self="@{each=ville}" label="@{ville.nom}" value="@{ville.id}" />
</combobox>

Thanks for any help !

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2010-11-11 04:53:39 +0800

gaiol gravatar image gaiol
20 2
http://www.bgserviceit.be

Ok, I resolved the problem by deleting the 'autodrop="true"' in zul file and add a villeCB.open() after modelVille.addAll(listVille) in my controller.

link publish delete flag offensive edit

answered 2010-11-10 17:28:30 +0800

gaiol gravatar image gaiol
20 2
http://www.bgserviceit.be

Thanks for the reply but the load is done in zul : load-after='self.onChanging'. That's not the problem. If you see at the picture, you will remark the double arrow for the combobox.
In fact, I would like to resize the list of the combobox after the load of the datas and keep the autodrop.

link publish delete flag offensive edit

answered 2010-11-10 16:06:45 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

modelVille.addAll(listVille);
binder.loadAll();

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-11-10 15:06:15 +0800

Seen: 456 times

Last updated: Nov 11 '10

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