Datatables reInitialization (jQuery)

前端 未结 5 769
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-04 08:54

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 (wi

相关标签:
5条回答
  • 2021-01-04 09:34

    When you initialize the datatable set bDestroy: true and before adding the update clear table via $('#myTable').dataTable().fnClearTable();. Thats it!!

    0 讨论(0)
  • 2021-01-04 09:37

    to clear the table, oTable.api().clear().draw();

    to reload data from ajax, oTable.api().ajax.reload();

    I don't think reInit is a good manner

    0 讨论(0)
  • 2021-01-04 09:38

    Can you use fnUpdate and fnClearTable? http://datatables.net/api

    0 讨论(0)
  • 2021-01-04 09:39

    use the initialization variable bDestory. Not nDestroy.

    0 讨论(0)
  • 2021-01-04 09:42

    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.

    0 讨论(0)
提交回复
热议问题