In my last post I wrote about the Ribbon Control. In this post I’m going to review three new UI features in SP 2010 that SharePoint itself uses but you as a developer can leverage in your own applications.
Status Bar
The status bar is for persistent information like page status or version. It will show just below the ribbon control and you can select 4 different background colors. The javascript api is pretty simple:
SP.UI.Notify.addNotification(strHtml, bSticky, tooltip, onclickHandler)
SP.UI.Notify.removeNotification(id)
Notification Bar
The Notification bar is less intrusive then the status bar and used for more transient information. By default each message remains on the screen for five minutes. Let’s look at some javascript to add and remove these notifications:
SP.UI.Status.addStatus(strTitle, strHtml, atBeginning)
SP.UI.Status.updateStatus(sid, strHtml)
SP.UI.Status.removeStatus(sid)
SP.UI.Status.removeAllStatus(hide)
SP.UI.Status.setStatusPriColor(sid, strColor)
Dialog Platform
One of the first things you will notice about SP 2010 is the effort the development team has put forth to reduce the number of page refreshes. One way to do that is to make use of Modal Dialog boxes. Just create a new list item and you will see exactly what I am talking about. You can make use of this Modal Framework using the javascript API. You will pass in another webpage or a DOM element. For example:
function myCallback(dialogResult, returnValue) {alert(“Hello World!”);}
var options = {url: “/_layouts/somepage.aspx”, width: 500, dialogReturnValueCallback:myCallback};
SP.UI.ModalDialog.showModalDialog(options);
I obtained the information in this post from Elisabeth Olson’s UI Presentation at the SharePoint 2009 Conference.