Using the Status Bar

To display, change, append a message on the Status Bar, and close the Status Bar, use the JavaScript SharePoint COM namespace SP.UI.Status. To display and then remove the Status Bar, use JavaScript functions similar to the following code:

<script language="ecmascript" type="textecmascript">
   var statusId = '';
   function displayStatusBar() {
      statusId = SP.UI.Status.addStatus("SPFIO Status Bar Title",
       "SPFIO message text", true)
      SP.UI.Status.setStatusPriColor(statusId, 'red'),
   }
   function removeStatusBar() {
      SP.UI.Status.removeStatus(statusId);
      statusId = '';
   }
</script>

The addStatus method takes three parameters, the status message title, the content of the status message, and whether the status message appears at the beginning of the list. The content of the Status Bar is in HTML message format and therefore can be more than just text; for example, it can consist of links and visual elements. The addStatus method returns the ID of the status message that can then be used by other status bar methods. The other status bar methods are:

  • SP.UI.Status.updateStatus(statusId,strHtml)

  • SP.UI.Status.appendStatus(statusId, strTitle, strHtml)

  • SP.UI.Status.removeStatus (statusId)

  • SP.UI.Status.removeAllStatus(hide)—can be used to remove status messages produced by other applications. It is not best practice to use this method.

Tip

INSIDE OUT Where can you find the source code for the Microsoft-provided JavaScript COM?

The signatures for all the versions of the JavaScript COM application programming interfaces (APIs) can be found in the SP*.debug.js files in the SharePoint root in the TemplateLAYOUTS subfolder. These are the equivalent of the minified SP*.js files. Therefore, you can look at the source code for all the client-side code provided by Microsoft.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset