Unregister a DataTables table

Unregister a DataTables table

pwc1011pwc1011 Posts: 62Questions: 0Answers: 0
edited January 2010 in General
Hello Allan,

It would be nice if DataTables had a function to unregister a table by table id. I would add the function, but I don't know how to best fit it in your plugin.

Justification...

Imagine a page with more than one object. Let's say the object is a "widget." Each widget has multiple properties that can be displayed nicely using datatables. User clicks on an object, a table shows listing the properties for widget. User moves on to next widget. It would be nice to remove the prior table and add the new table.

Having tested a scenario like this using datatables, I see that the table is still defined. Moreover, if the user selects a widget more than once, the datatable is recreated add appended to the dataTableSettings array, even though it has the same id. In our case, we keep track of the tables in our own array, and we look to see if the table was already created, and if so will remove it from the dataTableSettings array before recreating the table.

I would add this feature to datatables, however, I'm not sure how??? Moreover, I don't want to have problems with upgrades.

Let me know if this makes sense to you.

Thanks!
Patrick

Replies

  • allanallan Posts: 65,486Questions: 1Answers: 10,876 Site admin
    Hi Patrick,

    I fully agree - this would be a great thing to have. There are a couple of threads about this already:

    http://datatables.net/forums/comments.php?DiscussionID=1066
    http://datatables.net/forums/comments.php?DiscussionID=990

    I've just not had a chance to get around to doing it...

    Basically all it needs to do is remove the elements that DataTables adds to the DOM, and put the rows for the table all back in please.

    Regards,
    Allan
This discussion has been closed.