PDA

View Full Version : Is it possible to reorder EditorGrid?



timmah
4 Oct 2010, 10:46 AM
I am trying to reorder EditorGrid by using drag and drop. The following code works for a Grid, but I can't make it work for an EditorGrid.


new GridDragSource(grid);
GridDropTarget target = new GridDropTarget(grid);
target.setAllowSelfAsSource(true);
target.setFeedback(Feedback.INSERT);

Any help is appreciated !

Thanks!

sven
4 Oct 2010, 10:51 AM
What does "cant make it work" mean? You should describe a bit more what your problem is.

timmah
4 Oct 2010, 10:53 AM
The code that I've posted doesn't seem to work on an EditorGrid, hence I can't reorder rows using drag and drop on an EditorGrid. Am I doing anything wrong, or is this functionality not supported for EditorGrid?

sven
4 Oct 2010, 10:58 AM
You still have not explain what "does not work" means. What is happening when you try to reorder it?


You need to change the selectionmodel of your grid to GridSelectionModel. EditorGrid by default uses a CellSelectionModel.

timmah
4 Oct 2010, 11:46 AM
"Does not work" means re-ordering of rows on an EditorGrid does not work by drag and drop. As you suggested, reordering of rows starts to work when changing the SelectionModel to GridSelectionModel, but then I can't edit the cells anymore and a grid becomes a read-only grid.

Ideally, it would be nice to have an EditorGrid and be able to reorder the rows by using drag & drop. What I can probably do, is add a button which would switch the grid between editable and read-only modes.

sven
4 Oct 2010, 11:51 AM
Editing works fine for me with an EditorGrid and a GridSelectionModel and with dnd.

Can you please post a fully working testcase that implements EntryPoint and shows the problem?

timmah
4 Oct 2010, 12:10 PM
I take it back. Changing the selection model to GridSelectionModel fixed it. The rest was my fault. Thanks much for help ! Appreciate it!