How do I reinitialize TableTools after an ajax reload of the table?

How do I reinitialize TableTools after an ajax reload of the table?

swoodbridgeswoodbridge Posts: 2Questions: 1Answers: 0

I have a lot of DataTables in jquery Tabs and these tables get reloaded when their tabs are made visible. This part works fine. My problem is that tableTools does not work on these tables after they have been reloaded. I looks like I need to re-initialize tableTools on the table updated datatable but I am not seeing anyway to do this in the docs. I'm using jquery 1.11.1, the recent version of dataTables and TableTools-2.2.3.

Answers

  • swoodbridgeswoodbridge Posts: 2Questions: 1Answers: 0

    To answer myself after a lot more googling and read, it looks like this is the fix:

     var ttInstances = TableTools.fnGetMasters();
    
    for (i in ttInstances) {
        if (ttInstances[i].fnResizeRequired())
             ttInstances[i].fnResizeButtons();
    }
    
  • felixgillfelixgill Posts: 24Questions: 7Answers: 0

    This is awesome.. been trying to figure this out for an hour or so. Works like a charm on my datatable that is created in a hidden bootstrap tab.

  • felixgillfelixgill Posts: 24Questions: 7Answers: 0

    metadata:

    keywords to find this page:

    datatable datatables datatables.net tabletools button not working tab modal bootstrap

This discussion has been closed.