Hi,

What is the best way to implement an "open all" or a "close all" button? I am using a number of field groups as collapsible fieldsets. Everything works fine and the user can un-/collapse all fields individually. However, it would be nice to be able to offer a convenient way to open up or close all groups at the same time. Could anyone point me into the right direction to get this done?

Thanks, J.

Comments

grn’s picture

Issue summary:View changes

Yes, this feature would be very useful. It would be great, if you could set the default on entity level. For example old content would be expanded, while new content would be collapsed. In addition the user defined "expand all" and "collapse all" would be great.

grn’s picture

Version:7.x-1.1» 7.x-1.4
Component:Documentation» Code
Category:Support request» Feature request
mtraian’s picture

Hello,

Someone developed for me a module that might help you, here you have the link to download it.
https://github.com/barraponto/field_group_expand_all
Have a nice day,
Traian

grn’s picture

Thanks Traian. I think that Jelo was looking for exactly this functionality.

I am looking for a widget that will collapse or expand all field groups on a page. For example all comment field groups for all comments, like we have at Ideahunters.dk: http://ideahunters.dk/er-din-mund-din-ven-billigeborstehovederdk

I partly solved my problem with JQuery like this (not optimized):

jQuery(document).ready(function($){
//var foundin = $('div:contains("doitmain")');
var foundin = $(this).is(':contains("sammenfoldede")')
if ( foundin) {
console.log( "pak sammen" );
$("fieldset").addClass("collapsed"); //fjern collapsed classen fra alle fieldset's
}