1 Reply Latest reply on Jul 6, 2011 11:29 PM by nbelaevski

    how to move items on a <rich:dataTable />?

    gtludwig

      On a page, I have the following table:

       

      <rich:panel id="batchPanel">
         
      <table border="1" class="dr-table rich-table" width="100%">
             
      <a4j:repeat value="#{assemblyMB.batchLDM}" var="batch" rowKeyVar="row">
                 
      <tr>
                     
      <td>col1</td>
                     
      <td>col2</td>
                     
      <td>col3</td>
                     
      <td>
                         
      <a4j:commandLink action="#{assemblyMB.moveBatchToTop[row]}" render="batchPanel">
                             
      <h:graphicImage value="/images/icons/arrow_top.png" />
                         
      </a4j:commandLink>
                         
      <a4j:commandLink action="#{assemblyMB.moveBatchUpOnePosition[row]}" render="batchPanel">
                             
      <h:graphicImage value="/images/icons/arrow_up.png" />
                         
      </a4j:commandLink>
                         
      <a4j:commandLink action="#{assemblyMB.moveBatchDownOnePosition[row]}" render="batchPanel">
                             
      <h:graphicImage value="/images/icons/arrow_down.png" />
                         
      </a4j:commandLink>
                         
      <a4j:commandLink action="#{assemblyMB.moveBatchToBottom[row]}" render="batchPanel">
                             
      <h:graphicImage value="/images/icons/arrow_bottom.png" />
                         
      </a4j:commandLink>
                         
      <a4j:commandLink action="#{assemblyMB.deleteBatch[row]}">
                             
      <h:graphicImage value="/images/icons/delete.png" />
                         
      </a4j:commandLink>
                     
      </td>
                
      </tr>
           
      </table>
      </rich:panel>

       

      The reordering methods are:

       

      public void moveBatchToTop(int batchPos) {
          bservice
      .reorderBatchList(batchList.get(batchPos), 0);
      }

      public void moveBatchUpOnePosition(int batchPos) {
          bservice
      .reorderBatchList(batchList.get(batchPos), (batchPos - 1));
      }

      public void moveBatchDownOnePosition(int batchPos) {
          bservice
      .reorderBatchList(batchList.get(batchPos), (batchPos + 1));
      }

      public void moveBatchToBottom(int batchPos) {
          bservice
      .reorderBatchList(batchList.get(batchPos), batchList.size() + 1);
      }

      public void deleteBatch(int batchPos) {
          batchList
      .remove(batchPos);
      }

       

      I know the ordering methods work, but I can't access them from the page. How can I solve this?

      Thanks in advance,

      gtludwig