Hello list,

i am using data binding with qx.data.controller.Tree together with drag and
drop. The drop events give me the qx.ui.tree.Tree{File,Folder} targets (or
one of its children). In order to manipulate the model i need to know the
corresponding qx.data.model object which is the source bound to the tree
item. I am achiveing this with the following code:

getItemModel : function(treeItem)
{
  var bindings = qx.data.SingleValueBinding.getAllBindings();
  var modelItem = null;

  for (var hash in bindings)
  {
    for (var i = 0; i < bindings[hash].length && !modelItem; i++)
    {
      var target = bindings[hash][i][3];
      var source = bindings[hash][i][1];
      if (target == treeItem)
      {
        modelItem = source;
        break;
      }
    }
    if (modelItem)
      break;
  }
  return modelItem;
}

Although this works fine i am questioning myself if there is a faster or
more elegant way of handling this task.


Regards, Florian
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to