0

我正在尝试在我的项目中学习和实施 DataTable。其实我真的需要数据表导出功能。

我的页面上有一个按钮。它打开了 Kendo UI 窗口,一切都很好。但是当我单击新窗口页面上的“导出 excel,导出 pdf,...”按钮时,导出按钮对我不起作用。

我想我有一个脚本崩溃。我已经尝试了几个小时,但我做不到。您的所有帮助将不胜感激。

// 这是我的剑道窗口代码:

@(Html.Kendo().Window()
.Name("myWindow") //The name of the window is mandatory. It specifies the "id" attribute of the widget.
.Title("Login") //set the title of the window
.Content(@<text>

<table id="example" class="display" cellspacing="0">
   // my table content
</table>

<script>

    $(document).ready(function () {
        $('#example').dataTable({
            "dom": 'T<"clear">lfrtip',
            "tableTools": {
                "sSwfPath": "/Scripts/datatables/copy_csv_xls_pdf.swf"
            }
        });
    });

</script>




</text>)
.Draggable() //Enable dragging of the window
.Resizable() //Enable resizing of the window
.Modal(true)
.Visible(false)

)

// 剑道的脚本

<script>
    function openWindow() {
        var wdw = $("#myWindow").data("kendoWindow"); //get the Window widget's instance
        wdw.center();
        wdw.open();  //and call its open method

    }
</script>

// 我的按钮触发“openWindow();

 <input onclick="openWindow()" value=" Özet Tabloyu Göster " />

// 数据表导出脚本

<script>

    $(document).ready(function () {
        $('#example').dataTable({
            "dom": 'T<"clear">lfrtip',
            "tableTools": {
                "sSwfPath": "/Scripts/datatables/copy_csv_xls_pdf.swf"
            }
        });
    });

</script>
4

1 回答 1

0

您可以直接将表格标签的内容导出到 Excel 文件中,而不是使用 DataTable。请参考此链接答案

于 2014-07-23T09:21:27.120 回答