cancel
Showing results for 
Search instead for 
Did you mean: 

How to make the sections displayed in collapsed mode

andy2_0
Champ in-the-making
Champ in-the-making

While previewing a document, there are several sections (such as operations, sharing, properties …) in the right side. They are displayed in expanded mode by default. I want to make the first one to be displayed in expanded, but the others in collapsed by default. How to implement it?

Thanks for help!
3 REPLIES 3

anshu_kumar
Star Contributor
Star Contributor
Hello Andy,

The one's which you want collapsed mode by default, simply add and pass an optional parameter to 'createTwister' method.

For example, lets say I want to implement this on 'Document Properties' component.

Open 'document-metadata.get.html.ftl', locate the below line of code

Alfresco.util.createTwister("${el}-heading", "DocumentMetadata");

and add 'collapsed' parameter as done below

Alfresco.util.createTwister("${el}-heading", "DocumentMetadata", {"collapsed": true});

Now open 'alfresco.js', and locate the 'Alfresco.util.createTwister' method

and add the below mentioned lines of code

if(config.collapsed)
   {
     isCollapsed = true;
   }

to the below exact mentioned place.

   var collapsedPrefs = Alfresco.util.arrayToObject(Alfresco.util.createTwister.collapsed.split(",")),
      isCollapsed = !!collapsedPrefs[p_filterName];

   // Initial State
   YUIDom.addClass(elController, config.CLASS_BASE);
   ***********Start Added code***************
   if(config.collapsed)
   {
     isCollapsed = true;
   }
   ***********End Added code***************
   YUIDom.addClass(elController, isCollapsed ? config.CLASS_CLOSED : config.CLASS_OPEN);
   YUIDom.setStyle(elPanel, "display", isCollapsed ? "none" : "block");


Refresh Web Scripts and verify it.

Please let me know if it was helpful or in case of any issues implementing this.

Note: Don't forget to convert 'alfresco.js' to minified 'alfresco-min.js'

andy2_0
Champ in-the-making
Champ in-the-making
Dear ANSHU KUMAR

Thanks for your reply.

I followed your solution but it didn't work. I am afraid I may miss something and will try it again.

Thanks for your kind support!

andy2_0
Champ in-the-making
Champ in-the-making
Dear ANSHU KUMAR

Your solution works!

Here comes another requirement:
I just want at most one section to be expanded. For example, if the "File Operation" section is expanded, when I click the "Attributes" section to expand it, "File Operations" will be collapsed automatically.

Do you have any idea on this requirement? Thanks!
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.