0 Replies Latest reply on Apr 12, 2008 3:17 AM by Weifang Tang

    Can I add ajax abilities to myfaces checkbox component  usin

    Weifang Tang Newbie

      Hi,

      I'm using richfaces and myfaces.

      I want to send a AJAX request when a one of the checkboxes in a table is
      selected, so I tried as follows, but it didn't work. When the checkboxes
      checked, nothing happened.

      Please , help me. Thank you.

      <f:view>
       <x:saveState value="#{sAeBean}"/>
       <h:form>
       <rich:dataTable value="#{sAeBean.employeeList}" var="employee"
       ajaxKeys="#{sAeBean.ajaxKeys}" rowKeyVar="index" width="600">
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column>
       <h:outputText value="Select"/>
       </rich:column>
       <rich:column>
       <h:outputText value="Name"></h:outputText>
       </rich:column>
       <rich:column>
       <h:outputText value="Age"/>
       </rich:column>
       <rich:column>
       <h:outputText value="Department"></h:outputText>
       </rich:column>
       </rich:columnGroup>
       </f:facet>
       <f:facet name="footer">
       <x:selectOneRadio id="radio" layout="spread" value="#{sAeBean.selectedIndex}">
       <f:selectItem itemValue="0"/>
       <f:selectItem itemValue="1"/>
       <f:selectItem itemValue="2"/>
       </x:selectOneRadio>
       </f:facet>
       <rich:column>
       <x:radio index="#{index}" for="radio">
       <a4j:support event="onchange" action="#{sAeBean.showEdit }">
       <a4j:actionparam assignTo="#{sAeBean.selectedIndex}" value="#{index}" />
       </a4j:support>
       </x:radio>
       </rich:column>
       <rich:column>
       <h:outputText id="name" value="#{employee.name }"/>
       </rich:column>
       <rich:column>
       <h:outputText id="age" value="#{employee.age}"/>
       </rich:column>
       <rich:column>
       <h:outputText id="department" value="#{employee.department }"/>
       </rich:column>
       </rich:dataTable>
       <a4j:commandButton oncomplete="resetStatus();" action="#{sAeBean.showEdit }"
       value="Edit" />
       <a4j:outputPanel ajaxRendered="true">
       <h:panelGrid id="edit" columns="3" columnClasses="first, first, first" rendered="#{sAeBean.selectedIndex>-1}">
       <h:outputText value="Name:"></h:outputText>
       <h:outputText value="Age:"/>
       <h:outputText value="Department:"/>
       <h:inputText value="#{sAeBean.name}"></h:inputText>
       <h:inputText value="#{sAeBean.age}"></h:inputText>
       <h:inputText value="#{sAeBean.department}"></h:inputText>
       </h:panelGrid>
       <a4j:commandButton id="save" oncomplete="resetStatus();" rendered="#{sAeBean.selectedIndex>-1}"
       action="#{sAeBean.saveEdit }" reRender="select,name, age, department" value="Save"/>
       </a4j:outputPanel>
       </h:form>
       </f:view>