Skip to main content Home Help (new window) Eric Shupps
Go Search
Home
Blogs
Company
Products
Services
Current News
Idera Acquires Sonar from BinaryWave
BinaryWave Announces SharePoint Performance Optimization Service
Upcoming Events
DFW SharePoint Community Meeting
Home > Blogs > Eric Shupps > Posts > Modifying Grouped By Headers, Part Deux
Modifying Grouped By Headers, Part Deux
A while back I posted a tip about hiding grouped by headers in list views.  These are the content separators that appear at the top of a group of list items and have a +/- image for expanding/collapsing the group, the title of the group column, a colon and the group item name, like so:
 
+ Tasks: Testing
 
Many users, like myself, don't like to see the column title in the header - they just want it to say 'Testing' with the expand/collapse icon.  The most effective way to hide this element is to edit the CAML for the list view as I described in the original artice (which still applies in 2007 there are just more SCHEMA.XML files to edit); however, this only works on sites created AFTER the CAML has been changed.  So what to do if you've already created a bunch of sites and want to correct this problem?
 
The easiest method (or at least the easiest that I could come up with) is to add some javascript to your master page(s) to find the offending text and hide it.  There are really two parts to this: 1) isolate and remove the anchor tag with the column title, and 2) manipulate the HTML to get rid of the separating colon.  Here's the script:
 

<script type="text/javascript">

    function RemoveGroupHeader()

    {

        var elements = document.getElementsByTagName("a");

       

        for(var i=0; i<elements.length; i++)

        {

            if (elements[i].getAttribute('href') == "javascript:" && elements[i].outerHTML.indexOf("ExpCollGroup") != -1)

            {

                var text = elements[i].parentNode.innerHTML;

                var x = text.indexOf("</A> :&nbsp;");

                var y = x + 12;

                var leadingText = text.substring(0, x + 4);

                var trailingText = text.substring(y);

                elements[i].parentNode.innerHTML = leadingText + trailingText;

               

                if (elements[i].innerHTML.indexOf("Expand/Collapse") == -1)

                {

                    elements[i].style.display = "none";

                }

            }

        }

    }

</script>

 
In a nutshell, this script loops through the collection of anchor tags on the page to find the ones which have the expand/collapse functionality.  It then strips out the colon and hides the anchor tag with the column title.  To invoke it, add it to the existing 'onload' function in the <body> tag of the page.  Since there is likely to already be an onload event associated with each master page, you'll need to append the RemoveGroupHeader() function, like so:
 
Original:
 
onload="javascript:_spBodyOnLoadWrapper();"
 
Modified:
 
onload="javascript:_spBodyOnLoadWrapper();RemoveGroupHeader();"
 
Voila!  No more annoying column titles.  Enjoy!
 
 

Comments

SharePoint List Viewer Web Part

Is it possible to modify the code to have tool bar. So user can
add or update a lists from sub sites. I observed that this webpart allows to edit an item.

Have you guys intentionally blocked the add new entry?


Thanks,

Jess
at 6/26/2007 4:49 PM

List Viewer

Jess,

The answers to your quetions are 1) yes and 2) no.  There are two ways to get the views published by a list - one is to retrieve the raw view XML and render it using XSL, which is what the built-in web parts do.  This is a rather complext process, so I opted to use the second method to create the web part, which involves getting the sytem-defined HTML using SPView.RenderAsHTML() method. 

Unfortunately, this method doesn't return nice blocks of HTML that can easily be manipulated  - things like the column headers, toolbars, and footers are either missing or completely mangled.  The code primarily consists of string search and replace to get the views to render properly.

That being said, the 'Add New...' function could be added if the code base was expanded to include some additional OM methods and/or the raw xml via web services.    There may also be some new methods in 2007 to make this a bit easier but I haven't looked into them yet. 
at 6/26/2007 9:58 PM

Great enhancement.

Thanks for the great solution to this annoying problem. 

Also, I noticed that you're running this blog on WSS 3.0.  I'm part of the CKS:EBE project (http://www.codeplex.com/cks) and was wondering if you've posted the source code for the "email alerts" functionality you've added to this blog anywhere?  If not, could you contribute it to the CKS project?  It is really cool. 
at 7/2/2007 10:21 PM

Generic viagra

Generic Viagra
 

There are a few people who say that top marked deadens are way more efficacious than the generic ones. Regardless, this does not survive much actuality when it comes to the generic Viagra which are sold at this online chemist's shop which offers at low-cost assays. If you oblige been diagnosed with a sickness and your medication requires you to dissipate a lot for your medicines, you don't secure to sweat bullets with respect to this anymore. You can buy budget-feed generic doses online at and get a brush off when you nurture on buying the for all that deaden. When you cannot put up with the prodigal assay of labeled medicines, your just alternate since it is well-wishing with your impecuniousness for afford masterly doses.

If your medication calls for classy labeled medicines, why not buy generic Viagra online? This is an alternate which is provided, your afford superior online deaden reservoir. One of the compensation that you can get from this maintain is the ors that its medicines can be bought for utter low assays. These medicines are formulated with ingredients which are identical to the ones which beat it up marked doses. Regardless, the tolls of the two are in every respect altered. Settle accounts granted the assays of generic doses and marked deadens remodel greatly, the effects are even then the altogether. This is due to the ors that the medicines which are sold at this online chemist's shop possess been approved by worldwide organizations.

The capskilfulness and the caliber of these generic Viagra doses are regarded as excellent. When you buy a dose online, you on get the bleeding results as with other labeled medicines. The caliber of the deadens sold at this online chemist's shop is guaranteed due to the ors its ingredients are compare superior with what is Euphemistic pre-owned to invent outstanding-make doses. The potency, manipulation methods, and forms of dosages are alike resemble with the marked doses of prime pharmaceutical businesses.

You can buy trashy doses online when you are diagnosed with a bug. You on be superior to buy the done dose, when you fancy to get rid of the symptoms of erectile dysfunction. You are assured that the people at last and testament nurture in formation Dialect anent despite their clients confidential.

Author
Davidmaria
URL:
http://www.onlinepharmacy.vg/catalog/-c-32_117.html








at 12/30/2008 10:14 PM

now remove hyperlink

How do i remove hyper link from the testing? that would be helpful.
at 4/11/2009 5:20 AM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Your Name


Your URL


Comment Date *

To prevent spam from automated bots please provide a valid date in the format "MM/DD/YYYY".
Attachments