Problem with table column resizing when drag and drop is enabled

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

Problem with table column resizing when drag and drop is enabled

Romain FLIEDEL
Hi All,

I've noticed a problem with table column resizing in this case :
- table using drag and drop
- the table can be the source and the destination of the drag and drop

When you start resizing a column it triggers a drag and drop event ... is there a way not to trigger a dragstart event when moving over a table header ?

here is a code snippet (not tested) that should reproduce the problem
var tabModel = new qx.ui.table.model.Filtered();
tabModel.setColumns([ "col1", "col2", "col3", "col4", "col5" ]);
var table = new qx.ui.table.Table(tabModel);
table.setDropDataTypes(["table"]);
table.addEventListener("dragdrop", function(){}, this);
table.addEventListener("dragstart",   this.__handleDragStart,  this);
__handleDragStart: function(e){
   e.addData("table", "");
   e.addAction("move");
   e.startDrag();
}
You could ask what's the point of a drag and drop using the same element, but in fact I was trying to handle row reordering by selecting and row and moving it inside the table.
(actually this would be an interesting feature for qooxdoo 0.8)




This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problem with table column resizing when drag and drop is enabled

Romain FLIEDEL
Here is a workaround :
__handleDragStart: function(e){
            var pageX = e.getPageX();
            var pageY = e.getPageY(); 
            var scroller = table.getTablePaneScrollerAtPageX(pageX);
            if (!scroller) {
                return; // avoid access violation
              }
            var row = scroller._getRowForPagePos(pageX, pageY);
            
            if (row == -1)
            { //ignore drag event on table header
                e.stopPropagation(); 
                return;
            }    
}

Romain FLIEDEL a écrit :
Hi All,

I've noticed a problem with table column resizing in this case :
- table using drag and drop
- the table can be the source and the destination of the drag and drop

When you start resizing a column it triggers a drag and drop event ... is there a way not to trigger a dragstart event when moving over a table header ?

here is a code snippet (not tested) that should reproduce the problem
var tabModel = new qx.ui.table.model.Filtered();
tabModel.setColumns([ "col1", "col2", "col3", "col4", "col5" ]);
var table = new qx.ui.table.Table(tabModel);
table.setDropDataTypes(["table"]);
table.addEventListener("dragdrop", function(){}, this);
table.addEventListener("dragstart",   this.__handleDragStart,  this);
__handleDragStart: function(e){
   e.addData("table", "");
   e.addAction("move");
   e.startDrag();
}
You could ask what's the point of a drag and drop using the same element, but in fact I was trying to handle row reordering by selecting and row and moving it inside the table.
(actually this would be an interesting feature for qooxdoo 0.8)




This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php

_______________________________________________ qooxdoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problem with table column resizing when drag and drop is enabled

Peter Schneider
Here's another one (workaround):
I think I got the tip from the forum, but can't find the thread...

<code>
  _handleDragStart : function (e)
  {
    // Allow drag only in pane area
    if (e.getTarget().getParent().classname != "qx.ui.layout.CanvasLayout") {
      return;
    }
    // ...
  }
</code>

/Kuddel


> Here is a workaround :
>
>    __handleDragStart: function(e){
>
>                var pageX = e.getPageX();
>
>                var pageY = e.getPageY();
>                var scroller = table.getTablePaneScrollerAtPageX(pageX);
>
>                if (!scroller) {
>
>                    return; // avoid access violation
>
>                  }
>
>                var row = scroller._getRowForPagePos(pageX, pageY);
>
>              
>                if (row == -1)
>
>                { //ignore drag event on table header
>
>                    e.stopPropagation();
>                    return;
>
>                }  
>    }
>
>
> Romain FLIEDEL a écrit :
>> Hi All,
>>
>> I've noticed a problem with table column resizing in this case :
>> - table using drag and drop
>> - the table can be the source and the destination of the drag and drop
>>
>> When you start resizing a column it triggers a drag and drop event ...
>> is there a way not to trigger a dragstart event when moving over a
>> table header ?
>>
>> here is a code snippet (not tested) that should reproduce the problem
>>
>>     var tabModel = new qx.ui.table.model.Filtered();
>>
>>     tabModel.setColumns([ "col1", "col2", "col3", "col4", "col5" ]);
>>
>>     var table = new qx.ui.table.Table(tabModel);
>>
>>     table.setDropDataTypes(["table"]);
>>
>>     table.addEventListener("dragdrop", function(){}, this);
>>
>>     table.addEventListener("dragstart",   this.__handleDragStart,  this);
>>
>>     __handleDragStart: function(e){
>>
>>        e.addData("table", "");
>>
>>        e.addAction("move");
>>
>>        e.startDrag();
>>
>>     }
>>
>> You could ask what's the point of a drag and drop using the same
>> element, but in fact I was trying to handle row reordering by
>> selecting and row and moving it inside the table.
>> (actually this would be an interesting feature for qooxdoo 0.8)
>> [...]


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel