0

how to get value of textbox and checkbox in Listbox

asked 2012-09-25 08:31:47 +0800

progamerdotcom gravatar image progamerdotcom
117 5

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.

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-09-25 10:32:54 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

updated 2012-09-25 10:33:47 +0800

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();

}

}
} 

link publish delete flag offensive edit

answered 2012-09-25 11:14:58 +0800

progamerdotcom gravatar image progamerdotcom
117 5

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.

link publish delete flag offensive edit

answered 2012-09-25 12:51:37 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

updated 2012-09-25 12:53:45 +0800

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.

link publish delete flag offensive edit

answered 2012-09-26 00:59:37 +0800

progamerdotcom gravatar image progamerdotcom
117 5

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

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: 2012-09-25 08:31:47 +0800

Seen: 416 times

Last updated: Sep 26 '12

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