I have both a Tree and Table in a Form. If the Form is in read-only mode, I turn off dragging. When in edit mode, I turn it on using code like the following in the form’s setReadOnly() overridden method:
tree.setDragMode( readOnly ? TreeDragMode.NONE : TreeDragMode.NODE);
table.setDragMode( readOnly ? TableDragMode.NONE : TableDragMode.ROW);
Whenever a new item is set into the form’s datasource, this sets the drag mode as expected. But when the user clicks the cancel buttons to that basically just change the readonly mode of the form, and then clicks the edit button to put it back in non-readonly mode, dragging is not enabled again. That is, the drag mode is never turned back on even if readOnly==false occurs when I am debugging it (so I am setting the drag mode correctly).
But then I found if I also set the read only for the table and tree, it worked as expected:
tree.setReadOnly(readOnly);
tree.setDragMode( readOnly ? TreeDragMode.NONE : TreeDragMode.NODE);
table.setReadOnly(readOnly);
table.setDragMode( readOnly ? TableDragMode.NONE : TableDragMode.ROW);
So, for me, this is fine and works, no issue, but is there some issue with setDragMode() that if you change it, it’s not sent to the client? I mean, I know the client receives a bunch of other stuff in my case because buttons appear/disappear, fields go from edit to display mode, etc., but the DND on those components stopped working (actually, I only know that it stopped on the Tree only at this point) once turned to readOnly and then back without also setting the component’s readonly status.
Thanks!