3 Replies Latest reply on Oct 16, 2011 11:50 AM by rajkumarsrikanth

    Ajax Single Attribute for a4j command button

    rajkumarsrikanth

      Below is the xhtml used in my code.

       

      <!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:f="http://java.sun.com/jsf/core"
          xmlns:c="http://java.sun.com/jstl/core"
          xmlns:fn="http://java.sun.com/jsp/jstl/functions"
          xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:a4j="http://richfaces.org/a4j">
          <f:loadBundle basename="resources" var="msg" />
          <ui:composition template="/templates/common.xhtml">
              <ui:define name="pageTitle">Input User Name</ui:define>
              <ui:define name="pageHeader">Facelets Hello Application</ui:define>
              <ui:define name="body">
                  <a4j:form>
                      <h:inputText value="#{person.name}" />
                      <a4j:commandButton value="Search" action="#{person.search}" reRender="resultPanel" 
                          oncomplete="alert('complete');" />
                  </a4j:form>
                  
                  <h:panelGroup id="resultPanel">
                      <a4j:form>
                          <rich:dataTable id="myDataTable" value="#{person.countries}" var="country"
                              rowKeyVar="rowIndex" rows="23">
                              <rich:column label="Id" sortable="true"
                                  sortBy="#{country.id}">
                                  <f:facet name="header">
                                      <h:outputText value="Id"/>
                                  </f:facet>
                                  <h:inputText value="#{country.id}" />
                              </rich:column>
                              <rich:column label="Name" sortable="true"
                                  sortBy="#{country.name}">
                                  <f:facet name="header">
                                      <h:outputText value="Name"/>
                                  </f:facet>
                                  <h:inputText value="#{country.name}" />
                              </rich:column>
                          </rich:dataTable>
                          
                          <a4j:commandButton value="Search From Grid" action="#{person.search}" ajaxSingle="true" />
                      </a4j:form>
                  </h:panelGroup>
              </ui:define>
          </ui:composition>
      </html>
      

       

      My second command button uses ajaxSingle = true, but still when this button click the entire data from the data table is submitted the request. This request data was verified from firebug plugin and I am not able to figure out why this is happening.