3 Replies Latest reply on Jul 30, 2013 2:30 AM by Brian Leathem

    RF4.3.2: rich:panelMenu - activeItem attribute does not work as expected

    Alexey Shakov Newbie

      Hi,

       

      I need to control the panelMenu selection programmatically and use activeItem attribute to achieve this.

       

      But it does not work as expected. In the following example, click on the link "select test2 item" has no effect: panel item with name "test2" is getting not selected.

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
        xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"
        xml:lang="en" lang="en">
      <h:head></h:head>
      <h:body>
      
        <h:form id="container">
      
          <rich:panelMenu activeItem="#{testBean.compId}" id="menu">
            <rich:panelMenuItem name="test1" label="test1" render="container" action="#{testBean.setCompId('test1')}" />
            <rich:panelMenuItem name="test2" label="test2" render="container" action="#{testBean.setCompId('test2')}" />
          </rich:panelMenu>
      
          <a4j:commandLink value="select test2 item" action="#{testBean.setCompId('test2')}" render="container" />
        </h:form>
      </h:body>
      </html>
      

       

      testBean is a session scope bean:

       

      public class TestBean {
      
          private String compId = "test1";
      
          public String getCompId() {
              return compId;
          }
      
          public void setCompId(String compId) {
              this.compId = compId;
          }
      }
      

       

      What is wrong here?

       

      Thanks in advance for any help!

       

      Best regards,

      Alexey