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

Apex tree control

I would like to replace the opportunity product selection page with something more user friendly instead of just displaying a flat list of products. The ideas is a tree control display like:
+ Models
   + Family
      + Product Line
Model is defined by product record type: Model, Accessory
Family is defined by product family, e.g. "select family from product2 where recordtype = :model"
Product Line is defined by a custom field on Product, e.g. "select productline__c from product2 where recordtype=:model and family=:family"
Clicking + at product line gives you the products, e.g, "select name, ... from product2 where recrodtype=model and family=:family and productline__c = productline__c"
So, initially + Models isdisplay. Clicking on + expands to the Families under model. Clicking on a Family expands to the Product Lines under that Family, clicking + on product lines list all product under that recordtype, family, product line.
All obviously are controled by the selected Price Book.
Question: the functionality from an UI point of view is similar to what we have in the standard application under Setup: Clicking + under Customization gives you a list of standard objects, clicking a + next to a standard object gives you the various tasks you may perform.
How to do this on an APEX page?

Best regards,
London BenLondon Ben
Hi Per,

There's an example of a tree control used in a visualforce page in the just released 'Winter 09' webinar.

I suspect it wont be long until they release the examples used as sample code - but it's possibly worth emailing someone in relation to this - it's likely they'd be happy to supply you with the code to assist you in building something like that...
Redhorse LeeRedhorse Lee
Hi Ben,

I met the same problems. I also need to use a tree-like control to write an add-on to Could you send me the demo code? My email is Thank you very much!


Hi Friends,


Was anyone able to fix this up for a VF page?


I am trying my hand on a similar requirement but it does'nt seem to work in case of dynamic number of levels.


How can i fix this?? any ideas/pointers .....




Add DryAdd Dry

Hey Cool_D,


Did you get this working? I also need dynamic levels!