0 Replies Latest reply on Apr 27, 2007 1:37 PM by Bansilal Haudakari

    Populate fields using AJAX4JSF  based on radio button row se

    Bansilal Haudakari Newbie

      I got thru first hassle of
      "Select only one radio button row per dataTable " using Tomahawk component version 1.1.5 with forceId="true" forceIdIndex="false" as attributes to t:selectOneRadio

      Now based on the selected radio button row i wanna populate other fields in JSF page

      Please note my <h:dataTable> returns a List of Array of Objects as shown below

      <h:dataTable id="deviceDetailTable" styleClass="list" rowClasses="odd,even"
      value="#{deviceDetailBean.tableRows}" var="vartableRow"

      Backing Bean (DeviceDetailBean.java)
      private List tableRows;
      private DeviceDetail[] tableRow;

      public DeviceDetailBean(){
      tableRows = new ArrayList(10);
      tableRows.add(new DeviceDetail("10","0a0020b8a733","Intranet","","nams.dr.ca.boeing.com","A"));
      tableRows.add(new DeviceDetail("20","0a0020b8a733","Intranet","","nams.ns.cs.boeing.com","CNAME"));
      tableRows.add(new DeviceDetail("30","0a0020b8a733","Intranet","","altfantasy.ns.cs.boeing.com","A"));

      tableRow = (DeviceDetail[]) tableRows.toArray(new DeviceDetail[tableRows.size()]);


      public DeviceDetail[] getTableRow() {
      return tableRow;

      public List getTableRows() {
      return tableRows;

      public void setTableRow(DeviceDetail[] tableRow) {
      this.tableRow = tableRow;

      public void setTableRows(List tableRows) {
      this.tableRows = tableRows;

      Here is my Select only one radio button row per dataTable & other columns inside dataTable
      <h:column id="column1">

      <t:selectOneRadio id="radio1" value="#{deviceDetailBean.deviceDetail.id}" forceId="true" forceIdIndex="false">
      <f:selectItem itemLabel="" itemValue="#{vartableRow.id}" />
      <a4j:support event="onclick" reRender="selectors" />


      <f:facet name="header"><h:outputText value="MAC"/></f:facet>
      <h:outputText id="mac" value="#{vartableRow.mac}" />

      As you see i am using Ajax4JSF to reRender other component based on selected radio button
      <h:panelGrid width="100%" id="selectors" border="1" columns="2">
      <h:outputText value="Selected row: " />
      <h:outputText value="#{deviceDetailBean.deviceDetail.id}" />

      So i am able to print "id" value of the selected radio button as it has ajax4jsf event on it. But how do i print other values of the object. For example the following results in error
      <h:outputText value="#{deviceDetailBean.deviceDetail.mac)}" />
      <h:outputText value="#{deviceDetailBean.deviceDetail.namespace)}" />

      Any pointers/suggestions on how to print these values will be highly appreciated