开发者

Clicking on MenuItem without clicking on the text

I've got a Menu, and I want to click on the menu, but not on the text if you guys know what i mean. The MenuItem has a border, or something like this, but when I click on it it won't redirect to the page I want unless I click on text.

Is it开发者_高级运维 possible to click on the whole "Button" and redirect or do what is need to do?

My menu is like this:

<rich:dropDownMenu showDelay="250" hideDelay="0" submitMode="none">
        <f:facet name="label">Tools</f:facet>

        <rich:menuItem>
            <s:link view="/pages/tools/ppaParameters/PpaParametersEdit.xhtml" value="Parameters" id="PpaParametersId" includePageParams="false" propagation="none"/>
        </rich:menuItem>

        <rich:menuGroup value="Security">
            <rich:menuItem>
                <s:link view="/pages/tools/security/ppaModule/PpaModuleEdit.xhtml" value="Module" id="PpaModuleId" includePageParams="false" propagation="none" />
            </rich:menuItem>
        </rich:menuGroup>
</rich:dropDownMenu>

There's an example. I need to click on text to make it work out.

Clicking on MenuItem without clicking on the text


Style the menu item using:

display:block;

For example, for a rich:menuItem using h:link (instead of s:link, but same idea should apply):

<rich:menuItem immediate="true">
    <h:link value="System" outcome="menu-01" id="menu-01" styleClass="menu-item-link" />
</rich:menuItem>

Within the CSS, change the menu item label class (.rf-ddm-itm-lbl):

/* Allow clicking anywhere on a menu item, not just the text. */
.rf-ddm-itm-lbl {
    display: block;
}

/* Style the menu to taste. */    
a.menu-item-link {
    color: #333333 !important;
    text-decoration: none !important;
    display: block !important;
}

/* Remove space for icons. */
.rf-ddm-emptyIcon, .rf-ddm-emptyIcon {
    display: none;
}

Note the two instances of display: block;.


It's not perfect but could work. You can use something like this:

 <rich:menuItem onclick="location.href='url'">
     <h:outputText value="Link 2" />
 </rich:menuItem>

This will allow you to click anywhere inside the menu item.

url - you will have to put it yourself and add all the request parameters that s:link adds. For example: http://server/app/page.seam?cid=XX&propogate=xx...

If you need the conversation id, you can use: <s:conversationId>

Hope this helps...


Either give the text css selector the same height and width as its parent. Or give the button the behavior you're giving the text.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜