Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need a feature (shown in images below). The feature is available for Older versions but not for 2010. Is it possible to get Expand/Collapse buttons for any 2010 list?

The examples given below uses this jQuery Script

share|improve this question
1  
Which script added those +/- signs? Is it available freely? If so, you should simply try adding a new CEWP with the same scripts - they might plain and simple work! –  C. Marius - MVP Jul 23 '12 at 14:01
    
Its a jQuery Script –  neo269 Jul 23 '12 at 16:34

3 Answers 3

up vote 1 down vote accepted

Bill Simser has a JQuery script that does this here http://weblogs.asp.net/bsimser/archive/2009/11/12/hiding-the-new-toolbar-button-in-sharepoint-with-jquery.aspx

It could be easily ported once same elements have been identified.

share|improve this answer
    
@saumilm - Did you port it? How did it work for you? –  BGM Jul 24 '13 at 22:16

You can use the "Group By" option when modifying or creating a view on the list. This will create these expand/collapse nodes.

List View - Group By option

share|improve this answer
    
You are right, but I believe he meant the little +/- buttons on the toolbar which most likely are added via Javascript. –  C. Marius - MVP Jul 23 '12 at 14:00
    
Oh wow lol, I didn't even see those in the picture. –  RJ Cuthbertson Jul 23 '12 at 14:06
    
@C.Marius That's Correct! I wanted +/- buttons so that I can expand or collapse all groups by one click. Is that possible? –  neo269 Jul 23 '12 at 16:36
    
Yes, of course, update your Question with location of the script if that is available freely, or you shall most likely receive alternatives –  C. Marius - MVP Jul 24 '12 at 7:49
    
Updated the question with the code! –  neo269 Jul 24 '12 at 10:45

Here is how I've solved this, if you've used the "Group By" feature for the list. I add this code, perhaps, in a CEWP:

//This will auto-expand a list that has grouping set on it.
//set collapsemode to 1 to collapse everything; set it to 0 to expand everything.
//http://sharepoint.stackexchange.com/questions/73652/problem-with-jquery-function-for-expanding-grouped-lists/73695#73695
function AutoExpandList(collapsemode){
    if (collapsemode) {
        $("img[src$='minus.gif']:visible").parent().click();
    } else {
        $("img[src$='plus.gif']:visible").parent().click();
    }
}

Then, if I want expand and contract buttons, I add some buttons...

<a href="#" id="expandall">Expand All</a>
<a href="#" id="contractall">Contract All</a>

and then add this jQuery code to attach a function to those "buttons":

//set up expand and contract buttons for certain lists
function setupcontractors(){
    $("#contractall").click(function(){
        AutoExpandList(1);
    });
    $("#expandall").click(function(){
        AutoExpandList(0);
    });
}

Now I've got two clickable "buttons" that will expand or contract all the groups in the list. It works for any list.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.