开发者

What's wrong in my zkoss code?

 <listbox id="lbx" rows="4">
   <listhead><listheader label="Name"></listheader><listheader label="Album"></listheader></listhead>
  </listbox>
public class page extends GenericForwardComposer{
    Combobox searchBox;
    private Grid SuggestGrid;

    private String q;
     Button b;
    Page p;
    Label la; Listcell h,m;
    protected Listbox lbx; // autowired

    private ListModelList list,listq; // the model of the listbox
    public void doAfterCompose(Component comp) throws Exception {
        super.doAfterCompose(comp);


        for(int i=0;i<=10;i++)
        {
            Li开发者_C百科stitem li = new Listitem();
            new Listcell("example").setParent(li);
            new Listcell("google").setParent(li);

           Label subTotalLb = new Label("$example ");
           subTotalLb.setParent(li);
            li.setParent(lbx);
        }


    }

i can add only string in this list cell.

why cant i add button or label in this....


you can create your own Button in Listcell

public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);

    for(int i=0;i<=10;i++){
        Listitem li = new Listitem();
        Listcell lic = new ListCell();
        li.appendChild(lic);
        Button myBtn = new Button("Btn");
        myBtn.setParent(lic);

        //...

    }
}

Here are docs from zkoss.org Listboxes Contain Buttons

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜