-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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);
<combobox model="@{win$composer.entries}" selectedItem="@{win$composer.selectedItem}"> <comboitem self="@{each=entry}" value="@{entry}" label="@{entry.label}" /> </combobox>
The Small Talk articles provide similar examples, for sure.
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.
Asked: 2012-01-23 06:45:42 +0800
Seen: 294 times
Last updated: Feb 09 '12