0

onClick on label while iterating through a loop

asked 2014-12-10 11:02:25 +0800

AlwaysALearner gravatar image AlwaysALearner
3 2

I had posted a question before(forum.zkoss.org/question/95200/iterate-through-a-list-of-lists-in-zk-framework/) and implemented code based on the suggestion I got. I'm posting this question because the suggestion given in this question (forum.zkoss.org/question/65734/foreach/) didn't work for me. Here is my zul code-

<vlayout id="vlayoutId" spacing="0px" style="background-color: #F6F6F6">
    <zk forEach="${categoriesList}">
        <groupbox id="gbxId" mold="3d" style="top:470px;" visible="false">
            <caption label="${c:l('captionLabel')}" sclass="toggle_open">
                <div id="arrowUser" />
            </caption>
            <listbox id="lbxUser"></listbox>
            <div id="divNumOfUsers" style="cursor: pointer; padding: 4px; background-color: rgb(224, 224, 224);" visible="false">
                <label id="${each}" zclass="studyuser_item_label_other" forward="onClick = onClickLblMoreUsers" value="${each.value}" />
            </div>
        </groupbox>
    </zk>
</vlayout>

and here is my java code-

public void onClickLblMoreUsers(final Event event) {
    System.out.println("testing12345");
}

Also, when I did an 'Inspect element' on the label, I observed that the attribute forward="onClick = onClickLblMoreUsers" didn't appear. So, I hard-coded this way in java layer-

lblMoreUsers.setAttribute("forward", "onClick = onClickLblMoreUsers");
delete flag offensive retag edit
Be the first one to answer this question!
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
1 follower

RSS

Stats

Asked: 2014-12-10 11:02:25 +0800

Seen: 19 times

Last updated: Dec 10 '14

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