从 qx.ui.table.Table 拖放(Qooxdoo 版本 5.x 或大师)

Drag and drop from qx.ui.table.Table (Qooxdoo version 5.x or master)

我正在尝试从 qx.ui.table.Table 小部件拖到其他小部件。 我无法获得有关我尝试拖动的 table 行的信息。

我想在没有聚焦或选中的情况下拖动一行(分别是其内容),e.g.g只需单击该行并立即开始拖动。

谢谢, 弗里茨

我在这种情况下所做的是首先将 tables focusCellOnPointerMove 属性 设置为 true

如果您不想让单元格的反馈在鼠标移动时突出显示,您可以另外调用 table.highlightFocusedRow(false) 来抑制它。

这样 table 就是 cell/row 当前鼠标指针下的 "aware"。

然后您可以在 table 的 dragstart 事件处理程序中检测当前行索引:

 _onDragStartGetFocusedRow : function(e) {
   var index = this.getFocusedRow();
   if(qx.lang.Type.isNumber(index)) {
     // do something usefull with this information
     // and start dragging
     e.addAction("move);
     e.addType("myType");
   }
 },

完成拖放后,您可以通过调用 table.resetCellFocus() 重置焦点行,例如。在 dragend 处理程序中。

当然,这只适用于指针设备。