DataTable.destroy does not remove checkbox from table header

DataTable.destroy does not remove checkbox from table header

d3d3 Posts: 8Questions: 1Answers: 0

Hi,

I've recently upgraded to DataTables v2 and appreciate the improved checkboxes feature on the Select plugin. One thing I noticed though - if I call destroy() on my DataTable, the header <input> field remains and I have to remove it manually like this:

$('#main-table > thead > tr > th > input').remove();

Not a big problem, but I would have expected the HTML to be reset to the original state, per the documentation.

-David.

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    The same happens with the checkboxes in the rows too (in this example). Arguably, both should be reset.

    Colin

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin

    Thanks for flagging this up. I've committed a fix to address this issue and it will be in the next Select release.

    It is also a good point that Colin makes. On destroy I don't currently "derender" cells - the data is left in its rendered state, so it isn't just checkboxes, but dates and numbers have this artifact as well. Possibly it should be reverted, but I suspect that might add a large amount of code for something that has never come up before! I'll have a think about it.

    Allan

  • d3d3 Posts: 8Questions: 1Answers: 0

    Great, thanks for the quick response!

Sign In or Register to comment.