0 Replies Latest reply on Oct 3, 2013 4:51 AM by hugo.sayag

    'Whole' row Drag & Drop in a datatable

    hugo.sayag

      Hello,

       

      To explain the context, I have a few ordered data tables with embedded 'choose a line & up/down' functionnalities (screenshot...) that I'm trying to replace with a 'grab a row and drop it on another one' principle. I'm using Richfaces 3.3.3.

      FireShot Screen Capture #098.png

       

      In the existing code, the column list is dynamic (bean.items), the existing code using a c:foreach I'm not willing to replace since it does the job. What I managed to do is to grab whatever cell of a row and drop it on whatever cell of another row to move the whole row by 'simply' adding drag and drop support to the rich:column and passing the indexes of the dragged row and of the dropped row to my bean :

       

      <rich:dataTable id="mytable" var="element" value="#{mylist}" rendered="#{not empty list}" rowKeyVar="row" >           

      <c:forEach items="#{bean.items}" var="item">

      <rich:column>

      <rich:dropSupport acceptedTypes="int" dropListener="#{bean.processDrop}" reRender="table" dropValue="#{row}" />

      <rich:dragSupport dragType="int" dragValue="#{row}"/>                                                

      <f:facet name="header" align="center">

      <h:outputText value="#{item}" />

      </f:facet>

      <h:outputText value="#{bean.getColumnValue(element,item)}"/>

      </rich:column>     

      </c:forEach>

      </rich:dataTable>


      What I don't like with that solution is that I've got as many dropzones as I have cells which is quite ridiculous since I'm moving a row.


      Is there any way to implement a row wrapper 'between the rich:dataTable and the rich:column ??