-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Good afternoon all friends
I have listrenderer as show below :
public class MyContactListRenderer implements ListitemRenderer { public void render(Listitem item, Object data) throws Exception { Contact contact = (Contact) data; item.setValue(stdetail); new Listcell(contact.getNoHp()).setParent(item); new Listcell(contact.getContactName()).setParent(item); Listcell lc = new Listcell(); Textbox tb = new Textbox(); tb.setParent(lc); lc.setParent(item); Listcell lc2 = new Listcell(); Checkbox cb = new Checkbox(); cb.setParent(lc2); lc2.setParent(item); } }
I use this class to render a listbox, This listbox has a textbox and a checkbox, I use them to modify a field of contact , for example ( emailContact ),
I need help , how to get value of this textbox and checkbox within this listbox.
Thank in advance.
Regards,
Pro G.
Hi you can do some thing like this...In My Listbox i have INTBOX inside a ListCell..Take Help from BElow Code and implement for you.
Listbox box = (Listbox) comp.getFellow("listWindow").getFellow("mylist"); List<Listitem> item = box.getItems(); ListModel<Object> model = box.getModel(); for (Listitem listitem : item) { List<Component> com = listitem.getChildren(); for (Component compCell : com) { Listcell list = (Listcell) compCell; if (list.getFirstChild() instanceof Intbox) { Intbox pro cessPriorityBox = (Intbox) list.getFirstChild(); } } }
Hi sjoshi thank for your reply,,
I am new in ZK, so can you specify "listWindow" and "mylist".. isn't the ID of my component in zul file or what ??
double thanks.
Listbox box = (Listbox) comp.getFellow("listWindow").getFellow("mylist");
This code have these thing..
1-listWindow->This is the id of window component in Zul file.
2-mylist->this is the id of my Listbox component in zul file.
If you wire you Listbox then You can ignore above line. I am not wiring my Listbox from Java class so i am getting Listbox by above code.
its great, double thanks Sjoshi, its work,
Listbox box = (Listbox) dtlList.getFellow("win").getFellow("dtlList"); List<Listitem> item = box.getItems(); ListModel model = box.getModel(); for (Listitem listItem : item){ List<Component> com = listItem.getChildren(); for (Component compCell : com){ Listcell list = (Listcell) compCell; if (list.getFirstChild() instanceof Textbox){ Textbox tb = (Textbox) list.getFirstChild(); System.out.println("Tb value = "+tb.getValue()); } } }
Thanks
Asked: 2012-09-25 08:31:47 +0800
Seen: 416 times
Last updated: Sep 26 '12