-
FEATURED COMPONENTS
First time here? Check out the FAQ!
How to change the label of an item in java?
I would like to render the combo, but it didn't refresh it
I have just alse tried in zul file, this is the code:
<listbox mold="select" id="ppbt2" onCreate="self.setSelectedIndex(0)" >
<zk forEach="${dateTime}">
<listitem label="${each}" value="${each}" >
<attribute name="onClick">
<![CDATA[
Listcell c = new Listcell();
c.setLabel("COL");
self.appendChild(c);
self.setVisible(true);
]]>
</attribute>
</listitem>
</zk>
</listbox>
When I select an item of combo in firefox it show this error:
client error: Failed to mount: c.isSizedByContent is not a function
Please help me, Lara
Hi Lara,
Listcell not work with "select" mold, another way is use bandbox with default mold,
please refer to the sample below.
package j1f5qmi9$v1;import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.event.*;
import org.zkoss.zk.ui.util.*;
import org.zkoss.zk.ui.ext.*;
import org.zkoss.zk.au.*;
import org.zkoss.zk.au.out.*;
import org.zkoss.zul.*;public class TestComposer extends GenericForwardComposer{
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);}
public void onClick$btn(Event e) throws InterruptedException{
Messagebox.show("Hi btn");
}
}
<zk>
<zscript>
List dateTime = new ArrayList();
dateTime.add(new Date());
Integer ppbt3Cells = 0;
</zscript>
<bandbox id="bdx">
<bandpopup id="bdpp" width="200px">
<listbox id="ppbt3" onCreate="self.setSelectedIndex(0)" forEach="${dateTime}" sizedByContent="true">
<listitem label="${each}" value="${each}" >
<attribute name="onClick">
<![CDATA[
Listcell c = new Listcell();
c.setLabel("COL");
self.appendChild(c);
ppbt3Cells++;
bdpp.setWidth(200+ppbt3Cells*37+"px");
bdx.invalidate();
bdx.setOpen(true);
]]>
</attribute>
</listitem>
</listbox>
</bandpopup>
</bandbox>
</zk>
Thanks for the help, but I do not have to add an item (a row in the combo), but a cell.
That is, the items I have are made from a single cell,
but I should reload the combo with the same items, but with the addition of a new cell for each item.
The combo contains the hours, I charge it with the times and add next to each time a different value or text or an image.
I hope you can help me ... thanks so much
Asked: 2011-11-15 17:28:13 +0800
Seen: 385 times
Last updated: Nov 27 '11