This is a migrated thread and some comments may be shown as answers.

Populate RadTreeViewContextMenu root items from WCF

1 Answer 43 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 2
Mike asked on 13 Jul 2009, 09:55 PM
I'm trying to populate the RadTreeViewContextMenu when it first displays via WCF. Is there any built in functionality to do this? We currently have to put one item in the menu and set the expand mode to WebService. I know I could make a web service call to get this data (by firing on the OnClientContextMenuShowing), but I just wanted to find out if the RadTreeViewContextMenu had this functionality built in, which I may be overlooking. 

Also,  since every node in the tree could have a different context menu due to user permissions, I have to build the context menu each time by programmatically populating the context menu. However, once I've gotten the context menu for a node, I would really like to be able to cache the context menu. Would your suggestion be to just to store the menu.get_items() in an array stored by some key and then repopulate from that or is this functionality which may be coming in a future release (that is, a per node context menu that makes a service call only once per node)?

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 16 Jul 2009, 11:56 AM
Hi Mike,

We currently don't support automatic web service population for the root items of the context menu. We agree that this makes perfect sense in this scenario and we'll consider it for implementation.

The per-node caching is also a very sensible idea, but it'll be an opt-in feature, should we proceed with implementing it.

As for the moment, the best approach would be to include a "dummy"  item and populate the menu in the OnClientContextMenuShowing by first removing the placeholder item.

Caching can be implemented in the way that you describe. You can store the retrieved items in a cache object with the node index as key in the OnClientContextMenuShown event. Then as you proceed to populate the items, you'll check for a cache hit and use it instead of the web service.

Thank you for the good suggestions. As a token of our gratitude for your involvement, your Telerik points have been updated.

Greetings,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Mike
Top achievements
Rank 2
Answers by
T. Tsonev
Telerik team
Share this question
or