-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Deall All,
When I Select ListBox, Can only return "InfoNo", I want return "Info" or "FathInfoNo" or "Order by"
<?xml version="1.0" encoding="UTF-8"?> <zk> <div align="center"> <div height="20px"></div> <window > <zscript> import com.mysoft.estore.system.BaseInformation; ArrayList list= new ArrayList(); list =BaseInformation.list(arg.get("infotypeno")); </zscript> <textbox id="typeno" visible="false"></textbox> <listbox id="datalst" width="600px" height="215px" fixedLayout="true" onSelect="select()"> <listhead > <listheader label="Information Number" width="140px" align="left"></listheader> <listheader label="Information" align="left"></listheader> <listheader label="Father Number" width="140px" align="left"></listheader> <listheader label="Order By" width="100px" align="left"></listheader> </listhead> <listitem forEach="${list}" value="${each}"> <listcell label="${each.InfoNo}" style="border-left:1px solid gray;border-bottom: 1px solid gray"></listcell> <listcell label="${each.Info}" style="border-left:1px solid gray;border-bottom: 1px solid gray"></listcell> <listcell label="${each.FathInfoNo}" style="border-left:1px solid gray;border-bottom: 1px solid gray"></listcell> <listcell label="${each.OrderBy}" style="border-left:1px solid gray;border-bottom: 1px solid gray"></listcell> </listitem> </listbox> <zscript> void select() { //Can return InfoNo,But I want return Info or FathInfoNo or Order by alert(datalst.getSelectedItem().getLabel()); } </zscript> </window> </div> </zk>
I Can get Listbox current row all columns:
void select()
{
List children=datalst.selectedItem.children;
String InfoNo=((Listcell)children.get(0)).label;
String Info=((Listcell)children.get(1)).label;
String FathInfoNo=((Listcell)children.get(2)).label;
String OrderBy=((Listcell)children.get(3)).label;
}
You can do like this
void select() {
List children=datalst.selectedItem.children;
String InfoNo=((Listcell)children.get(0)).label; String Info=((Listcell)children.get(1)).label; String FathInfoNo=((Listcell)children.get(2)).label; String OrderBy=((Listcell)children.get(3)).label;
}
this code can only write in zkscript.when I write in java. "datalst.selectedItem.children" is wrong. waht's wrong?
Asked: 2012-12-27 05:56:55 +0800
Seen: 87 times
Last updated: Mar 22 '13