After navigation app requires I click everything twice

UI Components for JSF
Post Reply
fiktion
Posts: 100
Joined: 25 Aug 2010, 17:47

22 Nov 2010, 20:52

I am having a weird problem. I am currently running M1 and I have implemented a simple navigation system inside of a p:layout. The left column of the layout is the navigation menu and it works great except when I navigate to a new view, I must click twice on any button / link inside that view for it to work properly. When I click the first time the ajax dialog shows up and it Posts fine but nothing changes are displayed on the view. However changes are made if there are corresponding database calls. Here is an example. If I am inserting a new user.

If I click on the create User in the left nav the create user form will show up in the center layout unit. If I fill out the information and hit submit, it will add the user to the db fine but will not show the p:growl message that it was successful. If I submit the form again the message will show up and it will submit again to the db. This applies to every view that is populate using the left hand navigation.

My navigation works like this, please disregard any syntax errors as I am not copying and pasting.

layout.xhtml

Code: Select all


<p:layoutUnit position="left" >
    <ui:insert name="widgetMenu" />
</p:layoutUnit>

<p:layoutUnit position="center" >
    <p:ajaxStatus style="display:none" onstart="loading.show()" onsuccess="loading.hide()" />
    <ui:insert name="widgetContent" />
</p:layoutUnit>
index.xhtml

Code: Select all

<ui:define name="widgetMenu">
    <ui.include src="/'views/menu.xhtml" />
</ui:define>

<ui:define name="widgetContent">
   <h:form id="mainView">
       <h:panelGroup layout="block" id="viewCreate" rendered="#{bean.menuItem == 'create'}" >
           <ui:include src="/views/createUser.xhtml" />
       </h:panelGroup>

       <h:panelGroup layout="block" id="viewSearch" rendered="#{bean.menuItem == 'search'}" >
           <ui:include src="/views/searchUsers.xhtml" />
       </h:panelGroup>
   </h:form>
</ui:define>
menu.xhtml

Code: Select all

<h:form id="menuNav">

       <p:commandLink action="#{bean.updateMenuItem}" update="mainView">
            <f:param name="menuItem" value="create" />
             Create User
       </p:commandLink>

       <p:commandLink action="#{bean.updateMenuItem}" update="mainView">
            <f:param name="menuItem" value="search" />
             Search Users
       </p:commandLink>
</h:form>
bean.java

Code: Select all

public void updateMenuItem {
    this.menuItem = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("menuItem");
}

callahan
Posts: 768
Joined: 27 May 2010, 22:52

22 Nov 2010, 22:34

If I'm not mistaken, this issue was fixed in 2.2.RC1. See http://code.google.com/p/primefaces/iss ... il?id=1231. Why are you using 2.2.M1 :?: it's ancient :!:.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: david158 and 21 guests