Comobox DataBinding in ZK MVC
Here is a brief example as a start using ZK5 data-binding approach (I hope I understood your intentions correctly):
Suppose you have have a list of domain object from your database query and the objects have a bean property "label" which can be used to display the entry in the combobox item.
Then you implement the following methods in your composer (T is the type of your domain object):
public List<T> getEntries(); public T getSelectedItem(); public void setSelectedItem(T selectedItem);
Then you use the following combobox definition in your ZUL file:
<combobox model="@{win$composer.entries}" selectedItem="@{win$composer.selectedItem}">
<comboitem self="@{each=entry}" value="@{entry}" label="@{entry.label}" />
</combobox>
When a combobox item is selected, setSelectedItem() is called.
The Small Talk articles provide similar examples, for sure.
Hi Matze2
I am struggling with your codes as I am new, could you please share your codes of each file so that I can understand well?
regards
Short answer: I will not do that.
Long answer: If you are a beginner and you have no idea what I am talking about, then it is much more effective for you (and also for me by the way) to go through the tutorials and small talk articles which are available on this site.
Example 1: "Tutorial" (the first link on the Documentation page). There is a data-binding example at the end. This should be good start.
Example 2: The article "Create a database-driven application" has an example for listbox, which is very similar to the combobox use case above.
Believe me, you won't get a happy with a load of classes and ZUL files where you do not have the context understanding.
ZK - Open Source Ajax Java Framework
Hi Everyone,
I wanted to bind the data from the database table to the combobox item. I used MVC methodology in my applications and i wanted to implement it purely. So i don't want to implement the java code for databinding in the view (ZUML) file. Please give me some information and suggest some tutorial/ Example link for the solutions.
Thanks in Advance..
Regards
Swapnil