Results 1 to 6 of 6

Thread: Hiding parent nodes

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Hiding parent nodes

    Hello everybody,

    I have a treeview control in my application and a hierarchy of sub-nodes. Application works on rights. If user doesnt have rights to see a particular screen, the treeview node hides and user doesn't know there is some option of this screen in the application. Suppose I have a parent treeview node "Administrator", with a sub-node "Setup". "Setup" contains three more nodes, "Backup","Restore", "Reset". If user doesn't have rights to see all three Backup, Restore and Reset screens, these options hide but user can see "Setup" node and "Administrator" node.

    I need to traverse all the nodes and if all the child nodes of a node are not present(treeNode.Remove()), I want to hide/remove the parent node of that sub-nodes.

    Any ideas ??

    Thanks
    Last edited by usamaalam; Jun 3rd, 2005 at 12:44 AM.

  2. #2
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Hiding parent nodes

    I don't think that is possible.

    You will have to rebuild the treenodes in this scenario, and make the Setup node a parent node.

    If you find a way to do this, be cool and post it here. I would be curious to see how this can be done, allthough I doubt you can.
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  3. #3

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Re: Hiding parent nodes

    I have done the same thing with Menus, but there I was hiding the menu items not removing. Here in treeview, I already have removed the nodes that are not seen to the user. If somehow I know whether a node has child then this can be done easily.

  4. #4
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Hiding parent nodes

    why not count the node's children in code, and act accordingly?

    did not use it for a long time (tester now), but just search around, I know I found the help here on the forum
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  5. #5

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Re: Hiding parent nodes

    How ?? Do we have some property or I have to loop through the nodes recursively ?

  6. #6
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    Re: Hiding parent nodes

    i wrote a similar program. I created a new treeNode class from TreeNode and addes properties to indicate what TYPE of node it is..ie Setup, Application, File, etc...
    When the tree starts to build, the nodes react accordingly on their own depending on what type it is. If the user is an admin, all nodes were visible, if the user is say, a backup user, certain nodes hide themselves.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width