For our upcoming release, we have added an exciting new feature, drag and drop... The way it works is quite simple actually:

<grid

    enableExport="true"

    enableFilters="true"

    enableFooters="true"

    enablePreferencePersistence="true"

    enablePrint="true"

    forcePagerRow="true"

    pageSize="50"

    enablePaging="true"

    enableDrag="true"

    enableDrop="true"

    dragDropCompleteFunction="onDragComplete"

    >

 

This will enable the drag and drop operation on the grid. And here is the drag complete function

 

      //perform our action as a result of  drag drop.

      public void onDragComplete(IFlexDataGridDataCell target,FlexDataGrid targetGrid){           

            FlexDataGrid dragTriggerGrid=target.getLevel().getGrid();
            FlexDataGrid dropGrid=dragTriggerGrid;           

            Object dragItem= dragTriggerGrid.getDragRowData();//the object that we began the drag on
            Object dropItem=target!=null?target.getRowInfo().getData():null; //the object that we dropped on            

            List destArr =targetGrid.getDataProvider () ;
            List srcArr =dragTriggerGrid.getDataProvider() ;           

            srcArr.remove(srcArr.indexOf(dragItem)); //drop it into target

            destArr.add(dropItem!=null?destArr.indexOf(dropItem)+1:destArr.size()>0?destArr.size()-1:0,dragItem); //remove it from source           

            dragTriggerGrid.clearSelection();
            dropGrid.clearSelection();           

            Float pos = dropGrid.getVerticalScrollPosition();

            dragTriggerGrid.rebuild();    //rebuild
            dropGrid.rebuild();           

            dropGrid.validateNow();
            dropGrid.gotoVerticalPosition(pos);           

 

      }

This is what it will look like:


 

And here is the code:

MySampleApp.zip (157.58 kb)