6 Replies Latest reply on Jul 25, 2007 12:23 PM by Rulin Sun

    menuItem - reRender not working

    moldovan Newbie

      Hy Guys!

      It seems to me, that the reRender attribute of the menuItem isn't working. The action-method get called, but the content (is inside t:div), which should be rerenderd, get not updated.

      For testing, i implemented a a4j:button under my dropDownMenu with same action and same id in reRender-attribute. --> with this button it works.

      Also it found this warning in the a4:log, when i click the menuItem


      ...
      warn[11:23:26,644]: No information in response about elements to replace
      ...


      I'm using jboss-4.0.5GA, myfaces, richfaces+ajax4jsf snapshot from yesterday.


      and for information:
      I cannot surround my content, which should get updated, with an outputPanel and ajaxRendered-attribute setted to true because of complications of the outputpanel and my suggestionbox inside my content.



        • 1. Re: menuItem - reRender not working
          Ilya Shaikovsky Master

          Try outputPanel with layout:none - to avoid unnecessary wrapper elements at client side.

          • 2. Re: menuItem - reRender not working
            moldovan Newbie

            Solved it with a workaround:

            I surrounded the dropdownMenu with an a4j:form and setted the ID's of the content, which should be rerenderd by menuItems in the reRender-attribute of the form.
            This works, and is ok for me, at this time.

            • 3. Re: menuItem - reRender not working
              Simon Newbie

              Hi!
              I'm using rich faces 3.0.1 with a rich:toolBar and rich:menuItem ... and I'm facing the same problem.
              The workaround moldovan suggested didn't work for me. I tried surrounding the rich:toolBar with a a4j:form having a reRender attribute in it ... but that didn't work either.

              Does anyone know if that's a bug? Is somebody else facing that problem?

              Thanks!
              Simon

              • 4. Re: menuItem - reRender not working
                moldovan Newbie

                Hello silenco!

                Try it a 2nd time, it should work. I also have the menu inside a toolbar.

                For help:
                I will post you my main-jsp, and my included menu.jsp (where the menu is located).

                MAIN.jsp

                <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                 "http://www.w3.org/TR/html4/loose.dtd">
                <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
                <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
                <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
                <%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>
                <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
                <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
                
                <f:view>
                 <t:document>
                 <t:documentHead>
                 <title>WiMAX - WebAuthentication</title>
                 <a4j:loadStyle src="css/styles.css" />
                 <a4j:loadScript src="scripts/myscript.js" />
                 </t:documentHead>
                 <t:documentBody>
                 <a4j:region id="siteregion" selfRendered="true">
                 <jsp:include page="inc/header.jsp" />
                 <jsp:include page="inc/menu.jsp" />
                 <a4j:form ajaxSubmit="true" id="mainform">
                 <a4j:keepAlive beanName="userInput" />
                 <a4j:keepAlive beanName="applicationInput" />
                 <a4j:keepAlive beanName="groupInput" />
                 <a4j:keepAlive beanName="permissionInput" />
                 <a4j:keepAlive beanName="userEdit" />
                 <a4j:keepAlive beanName="userSearch" />
                 <a4j:keepAlive beanName="userDelete" />
                 <a4j:keepAlive beanName="groupEdit" />
                 <t:div id="content" styleClass="content">
                 <rich:tabPanel switchType="ajax">
                 <rich:tab id="inputtab" label="INPUT">
                 <jsp:include page="inc/tabContent_insert.jsp" />
                 </rich:tab>
                 <rich:tab id="useredittab" label="USER - DISPLAY/EDIT">
                 <jsp:include page="inc/tabContent_useredit.jsp" />
                 </rich:tab>
                 <rich:tab id="userdeletetab" label="USER - DELETION">
                 <jsp:include page="inc/tabContent_userdelete.jsp" />
                 </rich:tab>
                 <rich:tab id="groupedittab" label="GROUP - DISPLAY/EDIT">
                 <jsp:include page="inc/tabContent_groupedit.jsp" />
                 </rich:tab>
                 </rich:tabPanel>
                 </t:div>
                 </a4j:form>
                 </a4j:region>
                 </t:documentBody>
                 </t:document>
                </f:view>
                


                MENU.jsp
                <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
                <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
                <%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s" %>
                <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
                <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
                
                <a4j:form id="menuform" ajaxSubmit="true" reRender="menuform:menu, mainform:content">
                 <t:div id="menu" styleClass="menuregion">
                 <rich:toolBar itemSeparator="line" height="36">
                 <rich:toolBarGroup>
                 <rich:dropDownMenu value="Programm">
                 <rich:menuGroup value="UserSearch - Display" icon="images/icon_chooseview.png">
                 <rich:menuItem submitMode="ajax" value="SuggestionInput" action="#{userSearch.setSuggestionDisplay}"
                 icon="#{userSearch.suggestionDisplay == true ? 'images/icon_hackerl.png' : 'images/icon_transparent.png'}"
                 status="statuscomponent">
                 </rich:menuItem>
                 <rich:menuSeparator/>
                 <rich:menuItem submitMode="ajax" value="Table" action="#{userSearch.setTableDisplay}"
                 icon="#{userSearch.suggestionDisplay != true ? 'images/icon_hackerl.png' : 'images/icon_transparent.png'}"
                 status="statuscomponent">
                 </rich:menuItem>
                 </rich:menuGroup>
                 <rich:menuSeparator/>
                 <rich:menuItem submitMode="ajax" value="force Authservice-Update" action="#{methodsCollection.forceServiceUpdate}"
                 icon="images/icon_update.png" />
                 <rich:menuSeparator/>
                 <rich:menuItem submitMode="ajax" value="logout" action="#{methodsCollection.logout}" icon="images/icon_logout.png" />
                 </rich:dropDownMenu>
                 </rich:toolBarGroup>
                 <rich:toolBarGroup>
                 <a4j:outputPanel ajaxRendered="true">
                 <h:panelGrid columns="2" columnClasses=",messagesregiontablecolumn">
                 <h:column>
                 <h:outputText style="font-size: bold;" value="Messages:" />
                 </h:column>
                 <t:column style="margin-top: 2px; margin-bottom: 2px;">
                 <t:div styleClass="messagesregiontablecolumn">
                 <h:messages showSummary="true" showDetail="false" errorClass="errormessages" warnClass="warnmessages"
                 infoClass="infomessages" layout="table" />
                 </t:div>
                 </t:column>
                 </h:panelGrid>
                 </a4j:outputPanel>
                 </rich:toolBarGroup>
                 <rich:toolBarGroup location="right" rendered="#{applicationUser.enableMenuItems}" >
                 <h:outputText value="Username: "/>
                 <h:outputText value="#{applicationUser.userName}" />
                 </rich:toolBarGroup>
                 </rich:toolBar>
                 </t:div>
                </a4j:form>
                


                In this way the <t:div id="content"> and it's child-elements get reRenderd correctly

                Hope, this helps!

                • 5. Re: menuItem - reRender not working
                  Simon Newbie

                  hej moldovan!

                  Thanks a lot for your post. It helped me a lot.
                  The reason why it didn't worked was a missing

                  ajaxSubmit="true"

                  attribute in the <a4j:form> tag. Otherwise it submits the ajax request, but won't perform any rerendering.

                  Now it's working fine :)

                  Thanks again
                  simon

                  • 6. Re: menuItem - reRender not working
                    Rulin Sun Newbie

                    I had a similar issue with rich:dropDownMenu inside rich:dataTable. When I use ajax submitMode for the rich:menuItem, the action will not be invoked. If I move the dropDownMenu out of rich:dataTable (but in same form), it works as expected.

                    I did some debug tests using firefox firebug. I found the problem was, somehow, the reRender id didn't fill in the Ajax-Update-Ids ().