Hi Fredrik,

On 03.08.2013 21:57, walle wrote:
> So, I have found a solution to the problem regarding different context menues
> on different types of items.
>
> Now I only use one contextmenu, that is built when the contextmenu event is
> emitted on the tree item. Then I have access to the model data and can make
> every context menu unique if I would want to.
> It seems like a smart way of solving the problem, and more efficient than to
> store a context menu on all items in the tree. Any comments on this?
>

Sounds good to me. One improvement could be to only create two context 
menu instances (one for files and one for folders) and assign them to 
the tree items as needed. From within the menu, you can access the 
"opener" widget (the tree item that was right-clicked) and then get the 
model object from that so there's no need to create a unique menu for 
each item. Reusing existing widgets is generally preferable to creating 
new ones in terms of performance.

> I'm still wondering on how to select the right item and expand the tree
> there, but I guess a first version could jut be to loop over all items and
> check if it should be selected.

I think that's what you'll have to do. Traverse the tree's items, check 
if the model item is the one you want, then recursively call getParent() 
and open each folder until you hit the root.


Regards,
Daniel

>
> I have a new question, about filtering the data that should be visible in
> the tree when the data is loaded. If the web service gives more data than
> should be viewable. But I'll open a new conversation about that topic.
>
> I have updated the code if anyone is interested: http://tinyurl.com/qhht7ua
>
> Regards,
> Fredrik
>
>
>
> --
> View this message in context: 
> http://qooxdoo.678.n2.nabble.com/Using-model-data-in-tree-to-create-context-menu-etc-tp7584277p7584281.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Get your SQL database under version control now!
> Version control is standard for application code, but databases havent
> caught up. So what steps can you take to put your SQL databases under
> version control? Why should you start doing it? Read more to find out.
> http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to