Search code examples
javadrag-and-dropsmartgwtlistgrid

How to enable drag n drop between nested SmartGWT ListGrids


I got a ListGrid A that have rows, which can be expanded to display ListGrids of type B. Those ListGrids B also have rows that can be expanded to display ListGrids C. All ListGrids B are fed by the same datasource B, which is linked to datasource A by a foreign key. Similarly, all ListGrids C are fed by the same datasource C, which is linked to datasource B by a foreign key.

I want to enable drag n drop between all those ListGrids C only. So, during ListGrids C initialization, I call these to set up drag n drop engine:

    setCanReorderRecords(true);
    setCanDragRecordsOut(true);
        setCanAcceptDroppedRecords(true);
        setDragDataAction(DragDataAction.MOVE);
But I can only reorder rows within the same grid. Drag n drop between grids C doesn't work. Anybody has any idea about what I'm missing?

Thanks for any help.


Solution

  • I'm using SmartGWT 2.5. With this version, I had to enable drag n drop on the ListGrids of type B as well. I also added a drop handler on ListGrids B that cancels any drop actions by simply calling event.cancel(). It's not the perfect solution but at least it does work.