重新初始化数据表(jQuery的)初始化、数据表、jQuery

2023-09-10 13:26:12 作者:不懂年少轻狂。知道胜者为

当我打开我的网页排在首位有没有在表中的数据表不initializated,之后行增加了一些互动,当所有行添加(使用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 REINIT从源头code表。

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.

任何想法?

感谢您!

推荐答案

调用 $('#表)的dataTable()fnDestroy(); 将清除表中的dataTable code,让你操作表,然后调用的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.