1 Reply Latest reply on Mar 31, 2009 1:11 PM by Jay Balunas

    Unable to get refreshed data from datatable

    Waqas Arshad Novice

      Hi,
      I've a list which update datatable using ajax. Now my requirement is to pick the clicked row from the datatable. Everything is working fine but when i click the link it do nothing.

      .JSP

      <h:selectOneMenu id="tsheet" styleClass="text_body">
       <f:selectItem id="o1" itemLabel="Regular" itemValue="reg" />
       <f:selectItem id="o2" itemLabel="Supplement" itemValue="supp" />
       <a4j:support event="onchange" reRender="reg_table" action = "#{Test.getRegular}" />
      </h:selectOneMenu>
      <h:dataTable id="reg_table" value="#{Test.beanList}" var="reg" binding="#{Test.dataTable}" border="1" >
       <f:facet name="header">
       <h:outputText value="REGULAR TIMESHHET" />
       </f:facet>
       <h:column >
       <f:facet name="header" >
       <h:outputText value="Status" />
       </f:facet>
       <h:commandLink id="taskName" value="Approve">
       <a4j:support event="onclick" action="#{Test.getCurrentRow}"></a4j:support>
       </h:commandLink>
       </h:column>
       <h:column >
       <f:facet name="header" >
       <h:outputText value="Name" />
       </f:facet>
       <h:outputText value="#{reg.name}" />
       </h:column>
       <h:column>
       <f:facet name="header" >
       <h:outputText value="Age" />
       </f:facet>
       <h:outputText value="#{reg.age}" />
       </h:column>
      
      </h:dataTable>
      


      .JAVA
      public class Test {
       private List<MyBean> beanList = new ArrayList<MyBean>();;
       private HtmlDataTable dataTable;
       private MyBean dataItem = new MyBean();
      ...setter, getter
      public void getRegular() {
       beanList = new ArrayList<MyBean>();
       beanList.add(new MyBean("New1", "11", "1"));
       beanList.add(new MyBean("New2", "22", "2"));
       beanList.add(new MyBean("New3", "33", "3"));
      }
      
      public void getCurrentRow()
      {
       MyBean objMyBean = (MyBean) dataTable.getRowData();
       System.out.println("Name : -" +objMyBean.getName());
       System.out.println("Class : -" +objMyBean.getAge());
      }
      


      Any suggestions pleaseeee.