Quantcast

Table drag drop and cellTap event

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Table drag drop and cellTap event

rcosgrove
Some time ago when qx went from 3.5 to 4 click events in Table (and everywhere) were changed to cellTap events.   I noticed at the time on the list there were issues in the List and other places with drag and drop a result of this change which now seem to be resolved. At the time I cobbled together a few workarounds to get the table to behave correctly as it was also affected.    The basic problem is:

As cellTap changes the item selection to the mouseUp rather than mouseDown,  the item is not selected when dragging begins unless it was explicitly clicked on first before the drag.  Going by the demo browser the List solution appears to be; grab the drag item from e.getDragTarget() and ignore the selection.  This doesn't work for the table as we get the entire table Pane object instead which gives no clues as to what is being dragged.

The only way I have around this is to manipulate setFocusCellOnPointerMove() in such a way as to trigger the selection based on the focus which isn't perfect.   Is there a cleaner solution here?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Table drag drop and cellTap event

Dietrich Streifert-2
Hi,

my workaround/solution is to add an additional dragstart handler which
selects the focused row (code stripped from the production class, untested):


     _onDragStartSelectRow : function(e) {
       var row = this.getFocusedRow();
       if(qx.lang.Type.isNumber(row)) {
         this.resetCellFocus();
         // select the row via selection model
         this.getSelectionModel().setSelectionInterval(row,row);
       }
     },

and then add that listener to the dragstart event:

       table.addListener("dragstart", this._onDragStartSelectRow, table);

I don't know if it makes any difference concerning timing and visual
feedback, but I added the _onDragStartSelectRow handler before adding
the other drag related handlers.

The row selection only happens if the user really begins dragging. Just
clicking on the row and holding the mouse button down is not enough. But
it works for my users.

Regards
Dietrich

Am 18.11.2015 um 00:44 schrieb rcosgrove:

> Some time ago when qx went from 3.5 to 4 click events in Table (and
> everywhere) were changed to cellTap events.   I noticed at the time on the
> list there were issues in the List and other places with drag and drop a
> result of this change which now seem to be resolved. At the time I cobbled
> together a few workarounds to get the table to behave correctly as it was
> also affected.    The basic problem is:
>
> As cellTap changes the item selection to the mouseUp rather than mouseDown,
> the item is not selected when dragging begins unless it was explicitly
> clicked on first before the drag.  Going by the demo browser the List
> solution appears to be; grab the drag item from e.getDragTarget() and ignore
> the selection.  This doesn't work for the table as we get the entire table
> Pane object instead which gives no clues as to what is being dragged.
>
> The only way I have around this is to manipulate setFocusCellOnPointerMove()
> in such a way as to trigger the selection based on the focus which isn't
> perfect.   Is there a cleaner solution here?
>
>
>
>
>
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/Table-drag-drop-and-cellTap-event-tp7587777.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Give your users amazing mobile app experiences with Intel XDK.
> Use one codebase in this all-in-one HTML5 development environment.
> Design, debug & build mobile apps & 2-D/3-D games for multiple OSs.
> Then get your creation into app stores sooner, with many ways to monetize.
> http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Table drag drop and cellTap event

rcosgrove
Hey thanks that's actually quite a bit nicer than my solution it think i'll be using it :) Cheers
Loading...