button doesn't work after rendering

UI Components for JSF
Post Reply
prophet
Posts: 92
Joined: 17 Mar 2011, 19:59

02 Sep 2011, 12:15

I have p:dialog where I want to render buttons depending on step. My code is:

Code: Select all

		<p:dialog header="#{msg.dialogUserTableHeader}" widgetVar="bindDialog"
			resizable="true" showEffect="clip" hideEffect="fold"
			styleClass="panel">

			<h:panelGrid id="wizardContent">
			
				<h:panelGrid rendered="#{wizardController.step eq 1}">
					<p:commandButton id="test1" value="Test1"
						actionListener="#{wizardController.finish}" />
				</h:panelGrid>

				<h:panelGrid rendered="#{wizardController.step eq 2}">
					<p:commandButton id="test2" value="Test2"
						actionListener="#{wizardController.finish}" />
				</h:panelGrid>
				
			</h:panelGrid>

			<p:commandButton value="Next" update="wizardContent"
				actionListener="#{wizardController.next}" />

			<h:panelGrid columns="2" styleClass="dialogButtons">
				<p:commandButton value="#{msg.cancelButton}"
					onclick="bindDialog.hide();" />
			</h:panelGrid>
		</p:dialog>
My bean is:

Code: Select all

@ManagedBean(name = "wizardController")
@RequestScoped
public class WizardController {

        private Integer stepCounter = 1;

	public WizardController(){}

	public Integer getStep(){
		return stepCounter;
	}

       public void next(){
    	   stepCounter++;
           System.out.println("next");
       }

      public void finish(){
    	  System.out.println("finish");
      }

}

When dialog show I see only one button Test1, When I click it in consol i see "finish". when I click next, I see in consol "next" and button Test2 in dialog. But when I click button Test2 - no effect! Action listener doesn't work, nothing in consol... I can not understand why... What is wrong?

Thank you. I use PF-3.0M3, Mojarra - 2.1.3, Tomcat 6.

fenoloco
Posts: 53
Joined: 23 Aug 2011, 23:25
Location: Uruguay
Contact:

02 Sep 2011, 18:36

try adding process="@this" , I think a validation is the problem.

prophet
Posts: 92
Joined: 17 Mar 2011, 19:59

05 Sep 2011, 10:03

I've tried:

Code: Select all

			<h:panelGrid id="wizardContent">
			
				<h:panelGrid rendered="#{wizardController.step eq 1}">
					<p:commandButton id="test1" value="Test1"
						actionListener="#{wizardController.finish}" />
				</h:panelGrid>

				<h:panelGrid rendered="#{wizardController.step eq 2}">
					<p:commandButton id="test2" value="Test2"
						actionListener="#{wizardController.finish}" process="@this"/>
				</h:panelGrid>
				
			</h:panelGrid>
It doesn't work. Action listener of button "Test2" don't fire... Somebody know why?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 33 guests