Javascript DataTable和剑道窗口UI
我正在尝试学习DataTable并将其应用到我的项目中。实际上,我真的需要数据表导出功能 我的页面上有一个按钮。它打开了剑道界面窗口,一切都很好。但是当我在新窗口页面上点击“导出excel,导出pdf,…”按钮时,导出按钮对我不起作用 我想我的脚本崩溃了。我已经试了好几个小时了,但没能成功。我们将非常感谢你的帮助 //这是我的剑道窗口代码:Javascript DataTable和剑道窗口UI,javascript,jquery,datatable,kendo-ui,kendo-window,Javascript,Jquery,Datatable,Kendo Ui,Kendo Window,我正在尝试学习DataTable并将其应用到我的项目中。实际上,我真的需要数据表导出功能 我的页面上有一个按钮。它打开了剑道界面窗口,一切都很好。但是当我在新窗口页面上点击“导出excel,导出pdf,…”按钮时,导出按钮对我不起作用 我想我的脚本崩溃了。我已经试了好几个小时了,但没能成功。我们将非常感谢你的帮助 //这是我的剑道窗口代码: @(Html.Kendo().Window() .Name("myWindow") //The name of the window is mandator
@(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)
)
@(Html.Kendo().Window())
.Name(“myWindow”)//窗口的名称是必需的。它指定小部件的“id”属性。
.Title(“Login”)//设置窗口的标题
.内容(@
//我的表格内容
$(文档).ready(函数(){
$('#示例')。数据表({
“dom”:“Tlfrtip”,
“表格工具”:{
“sSwfPath”:“/Scripts/datatables/copy\u csv\u xls\u pdf.swf”
}
});
});
)
.Draggable()//启用窗口的拖动
.resizeable()//启用窗口的大小调整
.模态(真)
.可见(假)
)
//剑道剧本
<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(){
var wdw=$(“#myWindow”).data(“kendoWindow”);//获取窗口小部件的实例
wdw.center();
wdw.open();//并调用其open方法
}
//触发“openWindow()的我的按钮
//数据表导出脚本
<script>
$(document).ready(function () {
$('#example').dataTable({
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "/Scripts/datatables/copy_csv_xls_pdf.swf"
}
});
});
</script>
$(文档).ready(函数(){
$('#示例')。数据表({
“dom”:“Tlfrtip”,
“表格工具”:{
“sSwfPath”:“/Scripts/datatables/copy\u csv\u xls\u pdf.swf”
}
});
});
您可以直接将表标记的内容导出到excel文件中,而不必使用DataTable。请再次参考此您好,感谢您的回复@Nitin Mall,我的所有表都是动态的,因此DataTable的feauteres很好地包含了我的要求。
<script>
$(document).ready(function () {
$('#example').dataTable({
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "/Scripts/datatables/copy_csv_xls_pdf.swf"
}
});
});
</script>