Posted on Jul 14, 2005
(permalink)
I am implementing a copy/paste system on my treeview. My treeview consists of categories and items.
If you copy an item to the clipboard (via a context menu: Copy), you should be able to right click on a category node and paste (via a context menu: Paste) the entry.
If you copy a category to the clipboard (via a context menu: Copy) you can then either paste a copy of the category (i.e. in the underlying database I will duplicate all of the child nodes) or paste a link/shortcut/alias to the category.
In other words, I want to vary the context menu that displays on category nodes based upon the type of the node that is in the clipboard.
Option A: I imagine that I could do this by creating two different context menus for categories and then looping through all of the nodes and converting them from one type to the other server side, but that sounds inefficient and will require a decent amount of coding to implement.
Option B: I believe that I read that it is possible to dynamically modify context menus server-side. I haven't tried this, but does this mean that I could just make the modification server-side when the user copies and it will go into effect?
Option C: I was hoping I could instead do this client side and somehow intercept an event right before the context menu is drawn and then modify the context menu at that time...
Suggestions?