-
FEATURED COMPONENTS
First time here? Check out the FAQ!
hi,
I have inserted the data in the list and then added it into the combobox but somehow the combobox is not showing anything please help mi....
my code is as follows
<zscript>
public void loadContacts()
{
dbc.getAllContacts(contacts);
ListModel contactsModel= to.getModel();
System.out.println(contacts.isEmpty());
to.setModel(contactsModel);
}
</zscript>
<combobox id="to" width="400px" buttonVisible="false" autodrop="true">
<comboitem each="@{contacts.com_receivers}">
</comboitem>
</combobox>
whats wrtong with this code>????
not tested:
<zscript> public void loadContacts() { ListModelList contactsModel= new ListModelList( dbc.getAllContacts(contacts) ); System.out.println(contacts.isEmpty()); to.setModel(contactsModel); } </zscript>
hi thanks for reply..
i executed your code...but it is appending garbage....how to add specific fields of 'contacts list' in combobox???
IT is appending the objects as its...i want to access the lists field..please help me
p.s.
contacts is an Arraylist
getAllContacts returns the arraylist
please help mew I am stuck badly
Please refrer to databinding
And seems there is no such each attribute
each="@{contacts.com_receivers}">
hi matthewgo,
I refered the documentation...and tried using label, value properties...but it still is not working.....could u post a simple example how to can I bind the data...using List....contacts is my list....and com_receivers is beans proerty but somehow it is not working please help me!!!
Hi
This is a simple sample:
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?> <zk><zscript> public class Person { private String firstName; private String lastName; public Person(String a, String b) { this.firstName = a; this.lastName = b; } public void setFirstName(String firstname) { this.firstName = firstname; } public void setLastName(String lastname) { this.lastName = lastname; } public String getLastName() { return this.lastName; } public String getFirstName() { return this.firstName; } } public class Test{ List list; public Test(){ list = new ArrayList(); list.add(new Person("yy", "xx")); list.add(new Person("yy", "xx")); list.add(new Person("yy", "xx")); list.add(new Person("yy", "xx")); } public List getPersons(){ return list; } } Test test = new Test(); </zscript> <listbox id="lb" model="@{test.persons}"> <listhead> <listheader>A</listheader> <listheader>B</listheader> </listhead> <listitem self="@{each='person'}" value="@{person}"> <listcell label="@{person.firstName}" /> <listcell label="@{person.lastName}" /> </listitem> </listbox> </zk>
is it what you're looking for?
hi matthewgo,
thanks for your reply
Actually i have already implemented it with the listbox successfully....
Now I want to implement it with the ''combobox''.
I want to insert all the contacts in the combobox so that I can search them.
I want same approach as u posted the exmaple but for the combobox
Asked: 2011-08-18 11:36:55 +0800
Seen: 872 times
Last updated: Aug 26 '11