Status Bar in SharePoint 2010 - Tutorial

We can provide HTML content to the message. We can add images and styles. The status bar can have one of the pre defined colors(red, green, blue, yellow) depending on priority of the immage. For example if message is very important we can show it in red.
Status bar is exposed SharePoint JavaScript API defined inside sharepointroottemplateslayoutsSP.js

Methods exposed by SP.UI.Status

  • addStatus: Accepts three parameters Title, Message as HTML , show at begining as boolean. Returns status ID
    sid = SP.UI.Status.addStatus(strTitle, htmlMessage, boolatBegning)
  • removeStatus: removes status specified by status id.
  • removeAllStatus: Removes all Status bar messages. Pass true if you want to hide bar.
  • setStatusPriColor: Takes two parameter status id and colorsetStatusPriColor(sid,”red”)

<script langauage=”javascript”>
var statusID;

function ShowStatus()
statusID = SP.UI.Status.addStatus(“Information”,”This is my first status bar”,true);

The above script will show status bar in red.
We can show status bar in diffrent colors depending on importance of message. If very important then use red, if warning message in then use yellow color.


Post a Comment

Popular Posts