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
sdetweilsdetweil 

Multi-select checkbox tree view control

I need to rewrite the view filter control to handle our  product list.

 

so I want so do this with a tree control, with cascading checkbox,

 

expand a branch, select a sub-branch(selects all children), expand a sub branch and de-select one element or deeper sub branch. (delesects all children)..

 

I see need for tree, but don't see a solution..

 

is this a flash tool?

 

Sam

Best Answer chosen by Admin (Salesforce Developers) 
sdetweilsdetweil

using a jQuery plugin I can now do the expand/collapse checkbox tree with SF data from my controller.

see http://www.redcarrot.co.uk/2009/11/11/collapsible-checkbox-tree-jquery-plugin/

this has one bug in that is 'assumes' the css names match the ul/li tree id..

 

and one missing piece of data, sf builds ul id with ':' between the components, you will need to escape them

for example (if the <ul id="bob:mack">)

 

<script type="text/javascript">
jQuery(document).ready(function(){
        $('ul#bob\\:mack').collapsibleCheckboxTree();
});

</script>

 

I have one datalist recursion problem which I've posted as well.

 

I need to add the functions to save to/restore from xml.

 

 

 

All Answers

Shashikant SharmaShashikant Sharma

There is no such component but programatically you can develope it , I have provided a example how to create Hierarchy , by doing modification as per your need you can achieve it.

 

See this : http://forceschool.blogspot.com/2011/06/show-hierarchy-in-visualforce-page.html

sdetweilsdetweil

Thank you.

 

couple of extended questions

 

as I want the branch sections to expand/contract, my assumption is I can use the pageblocksection with  collapsible=true (so I don't have to write my own view control for this function),  but pageblocksection is not nestable..

so it looks like I have to build that collapse/expand logic myself.. (ugh)

 

I need to 'save' the selection state of the controller rendered list.  so I'm thinking that I would have a new custom object  which is by USER which has a label field, and a large text field to store and xml document.

I would render the list into the the xml document.. and put the user generated 'name' of the list in label.

 

then I can render the xmldocument into the tree view above, and back out.

I need an unknown number of these per user (3-20, maybe 50 as an outside limit).

 

I also need to compare the saved list against the actual data (product hierarchy) whenever the data changes (timestamp) .. I think because our usiness process wants long term visibility, the data objects canot be deleted, but only marked inactive (no longer selectable) that the xml and list view would contain an object reference (id) and the renderer would use that id to get the title/attributes of the object.

 

for shorthand, I would want to know if any sub-branch had an element de-selected, and only save those (recursive) child branches. we will need to build the soql select statement using this knowledge, and I want to keep the select list criteria as small as possible.

 

so, on create list,

     controller creates new list from product data

     user selects whatever they want, auto select full branch,

         user deselects whatever they want, auto deselect sub branch

     user 'saves' a named list.

          save list to xml object instance

 

user 'edits' a list

      select all named lists for this user

      user selects one,

          render the xml document

          if product data timestamp as changed since list built or edited

              create new list,

          modify users list with add/delete (may show user impact of the data change)

          user selects/deselects, save render list to xml, and save

 

when list is 'used'

        select list as view filter

               generate soql select to match criteria

               add to other criteria  (account, country, .....)

 

 

 

 

sdetweilsdetweil

using a jQuery plugin I can now do the expand/collapse checkbox tree with SF data from my controller.

see http://www.redcarrot.co.uk/2009/11/11/collapsible-checkbox-tree-jquery-plugin/

this has one bug in that is 'assumes' the css names match the ul/li tree id..

 

and one missing piece of data, sf builds ul id with ':' between the components, you will need to escape them

for example (if the <ul id="bob:mack">)

 

<script type="text/javascript">
jQuery(document).ready(function(){
        $('ul#bob\\:mack').collapsibleCheckboxTree();
});

</script>

 

I have one datalist recursion problem which I've posted as well.

 

I need to add the functions to save to/restore from xml.

 

 

 

This was selected as the best answer
pandi GSpandi GS
HI,

Can you share the jquery tree with dynamic data upon button click to render it? I need to show with tree expand/collapse with checkbox for each node.

Thanks