0 Replies Latest reply on Jun 16, 2008 2:29 AM by betul aydin

    sortabla datatable with commandlink problem

    betul aydin Newbie

      Hi.My problem is about commanlink in datatable.I want to get row information when I click commanlink in datatable.Everything works fine until I click sorttable icon for sorting column.After sorting column I cilcked commanlink I get last value of datatable.What is problem ?
      here is my datatable tag:

      <h:form>
       <rich:dataTable id="tablo" value="#{De.tablo}" var="satir" width="100%" onRowMouseOver="this.style.backgroundColor='#FBF7E6'" onRowMouseOut="this.style.backgroundColor=''" >
      
       <rich:column sortBy="#{satir.ad}">
       <f:facet name="header"><h:outputText value="Kod" /></f:facet>
       <h:commandLink action="#{De.bak1}" styleClass="comlink" >
       <h:outputText value="#{satir.ad}" styleClass="cell" ></h:outputText>
       </h:commandLink>
       </rich:column>
       <rich:column sortBy="#{satir.ad}">
       <f:facet name="header"><h:outputText value="Kod" /></f:facet>
       <h:commandLink action="#{De.bak1}" styleClass="comlink" >
       <h:outputText value="#{satir.soyad}" styleClass="cell" ></h:outputText>
       </h:commandLink>
       </rich:column>
       </rich:dataTable>
      
       </h:form>
      

      here is my De managed bean code for load datatable

       public DataModel getTablo(){
       liste =new ArrayList();
       tablo=new ListDataModel();
       Kol k=new Kol("1","a","1a");
       liste.add(k);
       k=new Kol("4","d","4d");
       liste.add(k);
       k=new Kol("9","g","9g");
       liste.add(k);
       k=new Kol("11","r","11r");
       liste.add(k);
       k=new Kol("3","f","3f");
       liste.add(k);
       k=new Kol("90","t","90t");
       liste.add(k);
       k=new Kol("5","i","5i");
       liste.add(k);
      
      
       tablo.setWrappedData(liste);
       return tablo;
      
       }

      here is my De managed bean code for getting row value that clicked by user:
      
       public String bak1(){
       Kol k=(Kol)this.tablo.getRowData();
       System.out.println(k.getAd());
       System.out.println(k.getSoyad());
       System.out.println(k.getKey());
       return "h";
       }

      Can anybody help me?