数据表重新初始化 (jQuery) [英] Datatables reInitialization (jQuery)

查看:28
本文介绍了数据表重新初始化 (jQuery)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我首先加载我的页面时,表中没有任何内容并且数据表未初始化,在添加了一些交互行之后,当添加了所有行(使用 ajax 调用)时,我以这种方式初始化数据表:

When I load my page in first place there nothing in the table and the datatable is not initializated, after a few interactions rows are added and when all rows are added (with ajax calls) I init the datatable this way:

oTable = $('#table).dataTable( {
            "bJQueryUI": true,
            "bSortClasses": false,
            "sDom":'T<"clear">',
            "sPaginationType": "full_numbers",
            "sDom": 'T<"clear"><"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>'
        } );

问题是我希望能够清除该表并继续在 html 中添加内容,然后在不使用 fnAddData 的情况下从该源代码重新初始化该表.

The problem is I want to be able to clear that table and keep on adding stuff in the html and then reInit the table from that source code without using fnAddData.

有什么想法吗?

谢谢!

推荐答案

调用 $('#table').dataTable().fnDestroy(); 会清空 dataTable 的表格 代码并允许您操作该表,然后再次对其调用 dataTable.

Calling $('#table').dataTable().fnDestroy(); will clear the table of dataTable code and allow you to manipulate the table, and then call dataTable on it again.

这篇关于数据表重新初始化 (jQuery)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆