Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Moving the row of the table up/down/start/end

782792Jul 28 2010 — edited Jul 13 2012
I 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2012
Added on Jul 28 2010
7 comments
4,282 views