Hello Florian,

the controller needs for internal purposes a reference from every tree  
folder to the corresponding model item too. So there is a more or less  
internal API for accessing there reference:
treeItem.getUserData("model")
But as I said, its more or less internal. Its not documented in the  
API and we can not guarantee this API to stay. But i don't think we  
will change that for a while and there will always be a reference to  
the model. So you don't need to worry about using it.

Regards,
Martin

Am 24.07.2009 um 21:39 schrieb Florian Giesen:

> 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


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

Reply via email to