Error rich:panelMenu example showcase doesn't

2019-09-04 23:10发布

Hi i can't replicate the example in the richfaces 4.3.0.Final showcase: http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=panelMenu&skin=blueSky Specifically in the rich:panelMenu component, when i run the code the panelMenu doesn't responde,and the panelMenuItem doesn't show, I change the code like this:

<rich:panelMenu style="width:200px" itemMode="ajax" groupMode="ajax">

to

<rich:panelMenu style="width:200px" mode="ajax">

and the panelMenuItems show and working, but this part doesn't work:

<a4j:outputPanel ajaxRendered="true">
      <rich:panel rendered="#{not empty panelMenuBean.current}">
                <h:outputText value="#{panelMenuBean.current} selected" id="current" />
      </rich:panel>
 </a4j:outputPanel>

Why? tnks.

1条回答
不美不萌又怎样
2楼-- · 2019-09-04 23:47

I've just tested with the exact same code from the showcase (I simply copied the whole h:form), and it worked alright.

You just have to create a backing bean called PanelMenuBean with the current String property and the updateCurrent listener method (receiving an ItemChangeEvent for the itemChangeListener attribute, according to the VDL docs for panelMenu):

@ManagedBean
public class PanelMenuBean {

    private String current;

    public void updateCurrent(ItemChangeEvent evt) {
        current = evt.getNewItemName();
    }

    // getter and setter ...
}
查看更多
登录 后发表回答