Treeview with dynamic (context sensitive) context menu items

  1. #1

    Treeview with dynamic (context sensitive) context menu items supporting DirectEvents

    Hi all,

    I am very new to Ext.Net (MVC) so this may be something I have just not found in the help/forums or I may be taking the wrong approach all together.

    I am building an app based on a plugin model (small subsets of functionality are provided by plugged in modules to the application as whole). The approach I have taken so far is to allow each module to add nodes (lazy loaded) to the treeview based on its context within the tree. However my next task has been to create a context sensitive context menu when a user right clicks on a node of the tree. We have this working at the moment as long as all of the menus are pre-generated in the home view, however what I want to do it dynamically build the menu by making a call back to the server (in the similar way to the method to populate the child tree nodes) to ascertain what the nodes should be.

    [Edit]
    I should have mentioned that I also would like to be able to specify DirectEvents on each context menu item node.

    Does anyone have any thoughts on the best approach to achieve this and some code examples would be most appreciated if you have them?

    Thanks

    Ian
    Last edited by lake; Jan 11, 2013 at 7:39 AM.
  2. #2
    Building the menu via a roundtrip to the server during a right click may not be the best choice because of the lag to hit server. Can you build out the menu ahead of time and dynamically show/hide options?

    Instead of attaching a DirectEvent to each menu item, you should try attaching a clientside listener to each item that calls a central DirectMethod and pass the item's id/name back to the server. That's more lightweight than attaching a directevent to each menu item.

Similar Threads

  1. Replies: 0
    Last Post: Mar 29, 2012, 12:50 PM
  2. Replies: 1
    Last Post: Nov 10, 2011, 1:16 PM
  3. GridPanel - Context Menu
    By Tbaseflug in forum 1.x Help
    Replies: 8
    Last Post: Sep 28, 2011, 4:01 PM
  4. [CLOSED] Odd rendering problems with a dynamic context menu
    By mattwoberts in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 11, 2011, 10:36 AM
  5. Dynamic context menu items
    By JonG in forum 1.x Help
    Replies: 2
    Last Post: Nov 26, 2009, 7:37 AM

Posting Permissions