To view full viewname in sharepoint

Cp_raj
Posted by in SharePoint category on for Intermediate level | Points: 250 | Views : 9797 red flag

In sharepoint view if the view name is bit long then its trimming the name with three dots. Last week I got a requirement from client that he need a fullname of the view.So I searched to see any configuration change in sharepoint. But I didnt come across any solution. So i plan to do it using javascript......



In this article, we are going to learn how to view the full viewname in sharepoint screen using javascript.


To View Full Viewname in sharepoint

Here I had take a simple screen to explain. For sample I had created a View name "Viewname_is_bit_long_trim_the_name". The name describes about the sample.But while displaying it display like this "viewname_is_bit_long...". Even if we increase the dropdown box the data won't display because while binding the data, the codebehind in sharepoint is checking, if the data is long its displaying with dots....



Source code and explanation

Open the sharepoint designer.Click on the viewnane_is_bit_long_trim_the_name.aspx page in designer.

Using  javascript, i searched the "viewname_is_bit_long..." word and i replaced this word with the actual full wording in the innerHTML

<script language="javascript" type="text/javascript">
document.body.onload = function () {
 var divEle = document.getElementsByTagName("div");
 for(var i=0;i<divEle.length;i++)
 {
  var aEle = divEle[i].getElementsByTagName("a");
  for(var j=0; j<aEle.length;j++)
  {
   var sText = aEle[j].innerHTML;
   if(aEle[j].innerHTML.indexOf('viewname_is_bit_long...')==0)
   {
    if(divEle[i].id.indexOf("Menu_t")>=0)
    {
    var orignalValue=document.getElementById(divEle[i].id).innerHTML;
    var duplicateValue=orignalValue.replace("'viewname_is_bit_long...","Viewname_is_bit_long_trim_the_name");
    document.getElementById(divEle[i].id).innerHTML = duplicateValue;
    }
   }
  }
 }

}
</script>

Its works.....Just place the code below the content tag





Conclusion

Full ViewName of the sharepoint page has been displayed.Like this to hide/disabled the sharepoint controls we can go for javascript or JQuery....

Thanks for reading, keep learning and sharing !

Page copy protected against web site content infringement by Copyscape

About the Author

Cp_raj
Full Name: Rajkumar Pauldurai
Member Level: Starter
Member Status: Member
Member Since: 5/26/2009 6:29:52 AM
Country:

http://www.dotnetfunda.com
I started my career with Asp,ms-access,sql server 7,xml.Then i updated to .net,share point server,Basics about Biztalk server

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)