asked
2020-06-07 22:54:23 +0800
shgleb94 31 ● 1 Hi there!
I have an issue with gathering data from bunch of decimalboxes which are stored in a listbox via listcell. Here's the code:
ZUL:
listbox style="border:none" id="Grid" multiple="true" rows="20" width="100%"
selectedItem="@{feemain$composer.current}">
<listhead sizable="true">
<listheader label="a" width="70%"/>
<listheader label="b" width="30%" sort="auto"/>
</listhead>
</listbox>
Java:
this.Grid.setModel(new BindingListModelList(Service.getCodes(branch, alias) , true));
this.Grid.setItemRenderer((ListitemRenderer)new ListitemRenderer() {
public void render(final Listitem row, final Object data) throws Exception {
String Data = (String) data;
Decimalbox db = new Decimalbox();
row.appendChild(new Listcell(Data));
Listcell haddacc = new Listcell();
haddacc.appendChild(db);
row.appendChild(haddacc);
}
});
Quantity of rows is controlled by Grid.setModel as the quantity of Decimalboxes too. I don't have any id of them to point.
I tried
System.out.print("item: "+HumoGrid.getItems().get(0).toString());
but it gives me this:
item: Listitem f2DP51>
Also tried
System.out.print("item: "+((Decimalbox)HumoGrid.getItems().get(0)).getValue().toString());
but it returns
org.zkoss.zul.Listitem cannot be cast to org.zkoss.zul.Decimalbox
So how can I get the data from these decimalboxes? Thanks in advance!