一、问题:‘NotifyScriptLoadedAndExecuteWaitingJobs‘ is undefined
描述:使用JavaScript对象模型调用搜索服务,在运行sp.search.js抛出异常:0x800a1391 - JavaScript 运行时错误: ‘NotifyScriptLoadedAndExecuteWaitingJobs‘ 未定义
解决方法:在页面引入init.js <script type="text/javascript" src="/_layouts/15/init.js"></script>
NotifyScriptLoadedAndExecuteWaitingJobs 就是在init.js中定义的,还有SP.SOD方法也是,如果出现“SP.SOD未定义”这种错误,同样引入init.js即可
二、问题:添加自定义CustomAction,点击后如何弹出模态窗体
<CustomAction Id="e5535f8e-b06c-4cd4-bcb2-ae51ae1fa2ec.FixDocRCA"
RegistrationType="List"
RegistrationId="101"
Location="CommandUI.Ribbon"
Sequence="10001"
Title="自定义按钮"
<!--表示在一个新窗体中打开-->
HostWebDialog="TRUE"
HostWebDialogHeight="420"
HostWebDialogWidth="510" >
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">
<Button Id="Ribbon.Domuments.Manage.FixDocRCAButton"
Alt="自定义按钮"
Sequence="100"
Command="Invoke_FixDocRCAButtonRequest"
LabelText="自定义按钮"
TemplateAlias="o1"
Image32by32="_layouts/15/images/placeholder32x32.png"
Image16by16="_layouts/15/images/placeholder16x16.png" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="Invoke_FixDocRCAButtonRequest"
<!--跳转到Post.aspx,在SharePoint2013的CommandAction中不支持JavaScript方法-->
CommandAction="~appWebUrl/Pages/Post.aspx?{StandardTokens}&SPListItemId={ItemId}&SPListId={ListId}}"
<!--某条文档记录选中该按钮才会启用--> EnabledScript="javascript:SP.ListOperation.Selection.getSelectedItems().length == 1"
/>
</CommandUIHandlers>
</CommandUIExtension >
</CustomAction>
另外在跳转页面Post.aspx的PlaceHolderAdditionalPageHead还应该引入
<WebPartPages:AllowFraming ID="AllowFraming1" runat="server" />
表示允许将该页面作为一个框架显示
SharePoint2013APP开发问题总结,布布扣,bubuko.com
原文:http://greensky.blog.51cto.com/3347654/1531875