Thursday, July 25, 2013

SharePoint Status Notifications and Pop Ups SharePoint 2013 Apps

First we need to refer following SharePoint related JavaScript and jQuery

<script type="text/javascript" src="YourLocation/Scripts/jquery-2.0.1.min.js"></script>
<script type="text/javascript" src="/_layouts/15/MicrosoftAjax.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>

After That You can



<script language="javascript" type="text/javascript">
    
    // This will automatically disappear after some time
    SP.UI.Notify.addNotification('Processing...', false);
 
    // This will remove after you click or removed by a code
    SP.UI.Notify.addNotification('Processing...', true);
 
</script>

image



<script language="javascript" type="text/javascript">
// Set the status and get the reference
var status = SP.UI.Status.addStatus("Info:", "Processed");
// Add a Color
SP.UI.Status.setStatusPriColor(status, 'blue');
//Set Time out time , If not It will be there until we click
setTimeout(function () { SP.UI.Status.removeStatus(status); },3000);
</script>

image


Few other Methods we can use



<script language="javascript" type="text/javascript">
    
    // Remove Specific status
    SP.UI.Status.removeStatus(status);
 
    // Remove All status
    SP.UI.Status.removeAllStatus(true);
 
</script>
Post a Comment