2011年9月10日 星期六

SharePoint 上 Ribbon 的 Javascript 語法收集

請先參之前的文章 使用Elements.xml 客製化 SharePoint 中的 Ribbon ( 自定Tab ) CommandAction="javascript:
var notificationId = SP.UI.Notify.addNotification('大家好!!!');




var statusId = SP.UI.Status.addStatus('Quite important status message');
latestId = statusId;
enableRemoveStatusButton();


最後在 </Elements> 前面加上 enableRemoveStatusButton()  這段程式碼

<CustomAction Id="NewRibbonButtonCommand.CheckEnable" Location="ScriptLink"
            ScriptBlock="
                var latestId = '';
                       
                function enableRemoveStatusButton()
                {
                  if (latestId == '')
                  {
                    return false;
                  }
                  else
                  {
                    return true;
                  }
                }"
                />


底色變成紅色

var statusId = SP.UI.Status.addStatus('Very important status message');
SP.UI.Status.setStatusPriColor(statusId, 'red');
latestId = statusId;
enableRemoveStatusButton();



清除某個Id的訊息

SP.UI.Status.removeStatus(latestId);
 latestId = '';
enableRemoveStatusButton();"


清除所有訊息


SP.UI.Status.removeAllStatus(true);
 latestId = '';
enableRemoveStatusButton();"

參考網址:http://www.sharepointnutsandbolts.com/2010/01/customizing-ribbon-part-1-creating-tabs.html

沒有留言:

張貼留言