2014-07-23 53 views
0

我想学习和实现DataTable到我的项目。其实我真的需要DataTable导出功能。DataTable和Kendo窗口UI

我在页面上有一个按钮。其开放的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 " /> 

// DataTable导出脚本

<script> 

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

</script> 

回答

0

与其使用DataTable,您可以直接将表标签的内容导出到Excel文件中。请参阅link answer

+0

再次感谢您对@Nitin Mall的回复,我所有的桌面动态数据表的功能都非常好。 – ispanak