0

How can i make a listitem as a button?

asked 2018-01-10 19:50:28 +0800

davidpotolski gravatar image davidpotolski
3 1

I wanted to make a listbox as if their listitens were buttons. I use href on my system's buttons to change screens and need to have the same function on my listitems

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-01-11 11:03:59 +0800

cor3000 gravatar image cor3000
3669 1 7
ZK Team

updated 2018-01-11 11:05:13 +0800

Hi David,

the first things that come to my mind are adding onClick listeners (client side / server side) to the listitems or add an link inside a listcell.

<zk xmlns:w="client">
    <listbox>
    <listitem label="1. redirect via server-side listener (might triggers popup blocker)"
        onClick='Executions.getCurrent().sendRedirect("somepage.zul", "_blank");'/>
    <listitem label="2. redirect via client side listener"
        w:onClick="window.open('somepage.zul', '_blank');"/>
    <listitem>
        <listcell>
            <a label="3. link with a=href" href="somepage.zul" target="_blank"/>
        </listcell>
    </listitem>
    </listbox>
</zk>

Finally I wonder why you chose listbox for that purpose and make each item act like a button. If you wanted to render just a list of <button>s based on a Collection that's possible without <listbox>:

in ZK CE with:

in ZK EE:

Robert

link publish delete flag offensive edit
Your answer
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: 2018-01-10 19:50:28 +0800

Seen: 6 times

Last updated: Jan 11