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
Niels_RNiels_R 

Standard page shown in VF Page, collapsible sections not remembered

Hi all,

 

I have a question, we have a custom object and the detail layout (standard page layout) is shown in a Visualforce page (so we can have different layouts shown based on the record type). When I collapse a section on the layout and go to another page and go back to the layout, the section is not collapsed anymore. So my question is: is there any way that it can be 'remembered' which sections are collapsed and which aren't, just like you have with the standard functionality?

 

Kind Regards,

Niels

dipudipu

I do not think there is any standard way to retain collapse/expand information in VF pages. Write a function like the following and call it after page is loaded by passing appropriate parameters. Please note that the page will have to remember the last state of the section. That might by done by checking all the section state and passing the information to the next page. 

 

Sorry to say that I would not do any of  these without asking SFDC support. Please note that following code is not tested and it is modified from the SFDC JavaScript function.

 

 

function twistSectionOnLoad(sectionId, collapse) {
   var parentDiv = document.getElementById(sectionId);
   var twisty = document.getElementById('img_' + obj.headerId);
   while (parentDiv.tagName != 'DIV') { parentDiv = parentDiv.parentNode; }
   var div = parentDiv.nextSibling; 
   var elemWasOn = false; 
   if (collapse) { 
       div.style.display = 'none'; 
       twisty.className ='showListButton';
       twisty.alt = twisty.title = 'Show Section - '+twisty.name;
       elemWasOn = true; 
   } 
  return !elemWasOn;
}

 

 

 

 

 

Niels_RNiels_R

Sorry for the late reply, I will pass this information on to a developer so he can have a look whether it will work...I will also ask SFDC Support if they have a solution for this.

 

Thanks.

DevNVDevNV

There is also an idea that was created a few years ago for this functionality: 

 

http://success.salesforce.com/ideaView?c=09a30000000D9xtAAC&id=08730000000Bqk2AAC