簡體   English   中英

使用jQuery word export插件時出現未定義的錯誤

[英]Undefined error when using jQuery word export plugin

我正在使用SAP UI5應用程序並嘗試將表數據導出到word文檔中,但在文檔中得到未定義的錯誤。 我在這里使用jquery.wordexport.js 我的html代碼如下定義

<head>
    <script src="FileSaver.js"></script> 
    <script src="jquery.wordexport.js"></script> 
    <script>
        sap.ui.localResources("odataservice");
        var app = new sap.m.App({
            initialPage:"idodataservice1"
        });
        var page = sap.ui.view({
            id: "idodataservice1", 
            viewName: "odataservice.odataservice", 
            type: sap.ui.core.mvc.ViewType.XML
        });
        app.addPage(page);
        app.placeAt("content");
    </script>
</head>
<body class="sapUiBody" role="application">
    <div id="content">Hi</div>
</body>

div內容顯示在屏幕上並且不是空的,點擊按鈕我在下面調用方法

onPressExport: function() {
    jQuery(document).ready(function($) {
        $("content").wordExport();
    });
},

我已經在根級別添加了兩個文件,並且導出文檔確實已經進入,但是文本內部寫有“未定義”文本。 嘗試在運行時在控制台中檢查id並嘗試不同的子div ID但仍然得到未定義的錯誤。 請建議這里可能出現的問題,或者我錯過了什么。

您不需要OnPressExport的'ready'事件:

onPressExport: function() {
    $("content").wordExport();
},

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM