在SharePointModal JavaScript中显示表格

时间:2018-10-03 09:21:10

标签: javascript sharepoint modal-dialog

在我的SharePoint应用程序中,我试图在模式对话框中显示表格。弹出模式,但是它是空的,我的控制台日志中没有错误。

我尝试将包含标签和信息的字符串传递给我的表。如果我在主页上显示表格,则效果很好。我试图更改将字符串传递到表并调用模式的顺序,但是无论如何它还是不起作用。

我创建了一个新页面,它将作为我的模式:

<%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
    <script type="text/javascript" src="../Scripts/jquery-3.0.0.min.js"></script>
    <!--<SharePoint:ScriptLink name="sp.js" runat="server" OnDemand="true" LoadAfterUI="true" Localizable="false" /> -->
    <!-- JavaScript -->
    <script type="text/javascript" src="../Scripts/moment.js"></script>
    <script type="text/javascript" src="../Scripts/DescriptionModal.js"></script>
</asp:Content>

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
    <WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" ID="full" Title="loc:full" />

    <div>
        <table id="descriptionTable">

        </table>
    </div>
</asp:Content>

我的JavaScript看起来像:

function showModalOnSuccess(item) {

    var tableString = '<tr><th>test</th></tr><tr><td>test</td></tr>';
$('#descriptionTable').html(tableString);
    var options = { url: "Description.aspx", width: 400, height: 300 }; SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);


}

0 个答案:

没有答案