Thursday, May 29, 2014

SharePoint 2010/2013 - Notifications options



SharePoint provide OTB model dialog which can be used from client side to show a message or loading splash which you load a application page on your model dialog. Below are the options that can be used in a content editor or JavaScript file on your SharePoint page.
Add this tag to avoid null ref error ( like 'SP.UI.Notify' is null or not an object or 
Message: 'SP.UI.ModalDialog' is null or not an object).
 < script src="/_layouts/SP.UI.Dialog.js" type="text/javascript" >
or
Try adding this in code after option declaration while calling popup.
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);

To give a Loading Notification for a model dialog. 
Start of displaying the notification
var waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Working on it', 'Please wait while we load your screen...', 70, 340);
To Stop the loading Screen
waitDialog.close();
If you want to display notification in the top right corner then use this.
To Start notification
var notification;
ExecuteOrDelayUntilScriptLoaded(function () 
notification = SP.UI.Notify.addNotification("BI Charts are getting loaded!", true);
});
 // ExecuteOrDelayUntilScriptLoaded this function prevent the null ref error and it wait till the SP.UI.Dialog.js loads.
To Stop notification
SP.UI.Notify.removeNotification(notification);
---------Example-----------------------

< script type="text/ecmascript" language="ecmascript" >

var statusId = '';
var notifyId = '';

function AddNotification() {
    notifyId = SP.UI.Notify.addNotification("Hello World!", true);
}

function RemoveNotification() {
    SP.UI.Notify.removeNotification(notifyId);
    notifyId  = '';
}

function AddStatus() {
    statusId = SP.UI.Status.addStatus("Status good!");
    SP.UI.Status.setStatusPriColor(statusId, 'red');
}

function RemoveLastStatus() {
    SP.UI.Status.removeStatus(statusId);
    statusId = '';
}

function RemoveAllStatus() {
    SP.UI.Status.removeAllStatus(true);
}

< /script >
 
PS: Please correct the tags spacing and add js file ref.

Source: https://msdn.microsoft.com/en-us/library/office/ee658473%28v=office.14%29.aspx

Happy Browsing!
Relax..

Saturday, May 10, 2014

SharePoint 2010 - Remove Chart Webpart  Default Options Display



To hide the legends and Other information ( Data options) from the Chart Webpart, Set ShowToolbar="False" from the SharePoint Designer in XSLT mode.



Happy Browsing!
Relax..