Moving the row of the table up/down/start/end
782792Jul 28 2010 — edited Jul 13 2012I have to create component for the table which should move the row one level up, one level down, at the start or end by clicking on these images( >| >> << |<).
Currently this is what I am doing-- Instead of the above requirements I am trying to achieve this functionality by allowing the user to drag and drop the row where ever he wants on the same table.
I have used the collectionDragSource and collectionDropTarget on the table
<af:table id="t1">
<af:column></af:column>
<af:collectionDragSource modelName="dragRow"/>
<af:collectionDropTarget modelName="dragRow" dropListener="#{DragAndDrop.dragAndDrop}"/>
</af:table>
Managed Bean
public DnDAction dragAndDrop(DropEvent dropEvent) {
int souceRowIndex, targetRowIndex = 0;
Row sourceRow, targetRow = null;
return DnDAction.MOVE;
}
I got the souceRowIndex, targetRowIndex ,sourceRow, targetRow but unable to interchange the row.
Please suggest how to move or interchange the row using rowIndex.
Is there any other way to achieve this functionality.