function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
paul-lmipaul-lmi 

creating a hierarchy in Visualforce

I was wondering if anyone had any advice on creating a hierarchy of items in VF tag UI.  We have a variable that is return as a list of items.  Each item has an id, and a parent id, as well as some other things.  There are several levels of parents, so for instance, an item with a certain id could be a parent of two other items, but also have a parent of its own.

 

I'm scratching my head trying to figure out an approach to show a hierarchy with this type of data set.

 

Example data set is this.  For a proof of concept, I did a simple pageBlockTable to ensure my underlying controller was doing what I needed.

 

http://img227.yfrog.com/img227/5840/testys.png

Best Answer chosen by Admin (Salesforce Developers) 
partha_cegpartha_ceg

You may like to take a look at this piece of code Hierarch view in VF

All Answers

bob_buzzardbob_buzzard

If it were me, I'd look to display this like the role hierarchy from the Salesforce setup menu.

 

Parents appear to the left and their children are indented one column for each level.

 

You should be able to do this using repeat tags, once you have built the appropriate hierarchy in code (at first glance it looks a list of node objects where each node can contain a list of child nodes).

divyar@infosys.comdivyar@infosys.com

Can some one help me out . Plz post the classes and VF page for the above requirement

partha_cegpartha_ceg

You may like to take a look at this piece of code Hierarch view in VF

This was selected as the best answer