15.05.2012 You find an updated version here.
08.07.2010 Updated the code to make it cross compatible for SP2007 and SP2010.
I got this request from Saran to display the field description when hovering the mouse over the column header in a list view.
Add this code to a CEWP and place it below the list view:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
if(typeof(_fV4UI)==='undefined'){ // SP2007
var myTooltipObj = customGetList(ctx.listName);
$(".ms-listviewtable th").each(function(){
var fieldDisplayName = $(this).find("table:first").attr('DisplayName');
if(fieldDisplayName==undefined){
fieldDisplayName = $(this).text();
}
if(myTooltipObj[fieldDisplayName]!=undefined){
$(this).attr('title',myTooltipObj[fieldDisplayName]).find('a').attr('title',myTooltipObj[fieldDisplayName]);;
}
});
}else{ // SP2010
var myTooltipObj = customGetList(_spPageContextInfo.pageListId);
$("div.ms-vh-div").each(function(){
var fieldDisplayName = $(this).attr('DisplayName');
if(myTooltipObj[fieldDisplayName]!==undefined){
$(this).attr('title',myTooltipObj[fieldDisplayName]);
}
});
}
function customGetList(listName){
xmlStr = [];
xmlStr.push('<GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/">');
xmlStr.push('<listName>' + listName + '</listName>');
xmlStr.push('</GetList>');
xmlStr = xmlStr.join('');
var result = {};
wrapSoapRequest(L_Menu_BaseUrl + '/_vti_bin/lists.asmx', 'http://schemas.microsoft.com/sharepoint/soap/GetList', xmlStr, function(data){
$('Field', data).each(function(i){
if(result[$(this).attr('DisplayName')]==undefined || result[$(this).attr('DisplayName')]==''){
result[$(this).attr('DisplayName')] = ($(this).attr('Description')==undefined)?'':$(this).attr('Description');
}
});
});
return result;
}
function wrapSoapRequest(webserviceUrl,requestHeader,soapBody,successFunc){
var xmlWrap = [];
xmlWrap.push("<?xml version='1.0' encoding='utf-8'?>");
xmlWrap.push("<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>");
xmlWrap.push("<soap:Body>");
xmlWrap.push(soapBody);
xmlWrap.push("</soap:Body>");
xmlWrap.push("</soap:Envelope>");
xmlWrap = xmlWrap.join('');
$.ajax({
async:false,
type:"POST",
url:webserviceUrl,
contentType:"text/xml; charset=utf-8",
processData:false,
data:xmlWrap,
dataType:"xml",
beforeSend:function(xhr){
xhr.setRequestHeader('SOAPAction',requestHeader);
},
success:successFunc
});
}
</script>
Note: This will only work when only one list view webpart is in the page.
Ask if anything is unclear.
Alexander

June 25, 2010 at 5:51 am |
[...] http://sharepointjavascript.wordpress.com/2010/06/17/show-field-description-in-list-view-column-head… Posted: 25/6/2010 4:51 por Juan Pablo | con no comments Archivado en: Sharepoint,Vistas,jQuery Deja tu comentario [...]
June 22, 2011 at 3:15 pm |
Thanks so much for this really useful piece of code.
Does anyone know the code changes needed to apply this for a data view ? This code works great in standard view for a list but not however when user switches to Datasheet
July 6, 2011 at 11:56 pm
Hi,
It is not possible to use this in a datasheet view.
Alexander
July 6, 2011 at 11:14 pm |
Agree this is useful! It doesn’t seem to work for choice columns, however – wondering if there is some code for those?? Thanks!
July 6, 2011 at 11:59 pm
Hi,
I have no problem showing the tooltip for a choice column. Are you sure you have entered a description for that field?
Alexander
July 7, 2011 at 6:55 pm |
Yes, I have several choice columns with descriptions that don’t show up. I’ve tried changing from drop down to check boxes or radio buttons, but stil doesn’t work.
Good to know that you’ve gotten it to work, though. Will keep playing around with it then. Thanks.
July 7, 2011 at 8:29 pm
Hi,
if you could send me some screenshots i might understand what the problem is.
You find my email here
Alexander
July 8, 2011 at 1:44 am |
HI Alexander – just wanted to make sure you received the screen shots from earlier today. Let me know if you need any further info. Thanks!
July 8, 2011 at 8:49 am
Hi,
Yes i got it, but I’m on GMT+1 and I did not look at it until this morning.
See updated code.
Alexander
July 8, 2011 at 7:41 pm |
Hi Alexander,
Thank you so much – this works great!!!!!!!!!!!! I really appreciate it — you solved my problem for me. Thanks again – fabulous!
December 7, 2011 at 5:27 am |
Hi, I can’t get this one to work. I am using SP 2007, jquery 1.8.11 and there is only one list view webpart on the page. I also have Christophe’s Text to HTML webpart on there.
When I hover over the column heading I get the standard “Sort by ColumnX” tooltip.
It seems so simple, but I can’t figure this one out. Would the view style or a custom theme make a difference?
December 10, 2011 at 2:19 pm
Hi,
jQuery has no 1.8.11 version, but jQueryUI has. Ensure you are referring jQuery in the page.
Alexander
December 12, 2011 at 4:16 am
Thanks… thats one those posts you wish could erase. You’re right, I was referring the jQueryUI for some reason. Thanks again!
May 10, 2012 at 5:25 pm |
I am not able to make this work. I am adding the code as it is in the content editor webpart just below the list. Can u please help me?
May 15, 2012 at 9:08 pm
Look at the new version – you find a link in the top of this page.
Alexander
May 15, 2012 at 9:05 pm |
[...] description in list view column header – updated version I have previously posted this solution that lets you add the field description to the list view column [...]