2014-07-23 102 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