I have a list view Grouped by Status column. Status Contains Active and closed values. now i want the default view to open with, Status:Active group to be Expanded and Status:Closed group to be collapsed.
|
Are you familiar with jQuery? There is a click() function that does just that: So the idea would be to identify the first expand button and click on it. Something like this: $("img[src*='plus.gif']").click(); Again, this seems like a heavy option, and just creating two views would be easier. |
|||
|
|
|
Although this post is quite old, this answer might help the ones who are searching for this functionality. In a list view grouped by Status column, where Active status should be expanded and Closes Status should be collapsed: Using IE developer tools or Mozilla Firebug, locate the (html element) image ID for the collapse-expand image (the '-' image). You'll find this img tag element to be enclosed within an tag. This tag has a javascript function for onclick event as shown below:
Note that the image ID may differ based on your page. Also, Note that the expand collapse functionality is achieved by calling the javascript function 'ExpCollGroup'. All you have to do now is to script this function call in a CEWP added to your list view page (ignore the 'return false' part). Go ahead and add a content editor web part to your list view page and ensure that this CEWP is below the LVWP. Paste the following code in the source editor window of the CEWP:
I had tried this solution on MOSS 2007 site, but I guess this solution may work for SP2010 also. |
|||
|
|
|
You don't have this option out of the box. I would simply create two grouped views on the same page, one filtered for status active, and the other filtered for status closed. Another solution would be to create the view as collapsed, and write a script that simulates a click after the view has loaded. |
|||
|
|
|
Using the ID will not work as is changing all the time, I'd use instead the name of the Category and in your case get find the related status and match category names. In my case I'm sending the name of the category in the URL to expand a category : (You can edit the page View or add a content editor web part)
|
||||
|
|