Pages

Thursday, August 25, 2011

Hide the Quick Launch in SharePoint 2007/2010

We do have one requirement in which customized search result page  needs to use full width of the page , it means I need to hide Quick Launch for that page.

There is not any out of the box way by which we can easily hide or make invisible the Quick Launch and the Tree View navigation in SharePoint 2010 sites. 

How to do this?

The easiest way is to do this is
1> Edit the Page by selecting from Site Actions.
2> Add a Content Editor Webpart
3> Add the following text in the HTML Source mode:

#s4-leftpanel{
display:none
}
.s4-ca{
margin-left:0px
}

I applied this logic to pages which are related to Team Site.

See the magic!!!!! :)

Disha Shah

Wednesday, August 24, 2011

SharePoint 2010 :JQuery Magic SPCascadeDropdowns with the same list

Hello Friends


I have this below situation in which all SharePoint lists has been created  and deployed to the production and Users are using this list , their list structure is like this.


First List ,name is "Country" list  which contains "title" field is text field and act as "Country" and "State" field contains name of the State in that country.


Below  is the "City" list in which  we have Country and State as Lookup column and "Lookup" list is "Country" and City name will come under the "Title" field.


Now, on production actual problem has been started when they insert the city inside the list,  because country and state has not been cascading. It is production and people already using it. How to add atleast the minimum cascading so user select the right state depends on country.

Let us use the magic of JQuery.

Here is simple javascript code that I have used to accomplish this.

<script language="javascript" src="/Shared%20Documents/jquery-1.3.2.min.js" type="text/javascript"></script><script language="javascript" src="/Shared%20Documents/jquery.SPServices-0.6.2.min.js" type="text/javascript"></script><script language="javascript" type="text/javascript">

var sCamlQuery = "";
$(document).ready(function() {

// Cascade definition for State dropdown
$().SPServices.SPCascadeDropdowns({
    relationshipList: "Country",
    relationshipListParentColumn: "Title",
    relationshipListChildColumn: "State",
    parentColumn: "Country",
    childColumn: "State" ,
    completefunc: function() {
        sCamlQuery = "<Eq><FieldRef Name='Title'/><Value Type='Text'>" + $("select[title='Country'] option:selected").text() + "</Value></Eq>";
    }
  });
});</script>

After add this script inside the "Content Ediotr Webpart" we have below results, users happy , we happy.























Exact thing what we need!!!
Thanks JQuery!!!

Disha Shah

Tuesday, August 9, 2011

SharePoint 2010: Change the “Add New Item” (and other) messages for a all SharePoint List Types

In SharePoint, to add a new item/document we always have one standard message like “Add a new item”.

Users who are familiar with SharePoint they are used to understand but sometimes users do not understand they have question why I it always has said “ Add a new item”. So to avoid confusion let us add user friendly message.

How to do that? Let us use power of javascript.

Steps:

1. Add a content editor webpart in the page and add this javascript. Add Content Editor Webpart at the end of the page after list.

2. “<script> document.getElementById("idHomePageNewItem").innerHTML="Click here to insert a new country"</script>”
This is just the text message for SharePoint Custom List how to make change for each type of list.

Below is list for id for every SharePoint list type.

ID’s used by web parts
SharePoint List Type
Default message
ID for “.getElementById” in the code below
Announcements
Add new announcement
“idHomePageNewAnnouncement” (changed in 2010)
Links
Add new link
"idHomePageNewLink" 
Calendar
Add new event
"idHomePageNewEvent"
Picture Library
Add new picture
“idHomePageNewItem”  *  (changed in 2010)
KPI List
Add new item
"idHomePageNewItem"  *  (changed in 2010)
Tasks
Add new item
"idHomePageNewItem"  *  (changed in 2010)
Project Tasks
Add new item
"idHomePageNewItem"  *  (changed in 2010)
Document Library
Add new document
"idHomePageNewDocument" 
Wiki
Add new Wiki page
"idHomePageNewWikiPage"  
Discussion
Add new discussion
"idHomePageNewDiscussion" 
Custom List
Add new item
“idHomePageNewItem”

Hope this helps!!!
Disha Shah