TableTools breaks DataTables when set as "sDom" default
TableTools breaks DataTables when set as "sDom" default
drakej
Posts: 11Questions: 0Answers: 0
Not sure if this should go in Bug Reports or here but since it's specific to TableTools I chose here.
When I attempt to initialize a table with .dataTable(); and no other arguments (all defaults) I get an error:
"Cannot read property 'tableTools' of null"
The source of this error is based on how I have dataTables defaults configured. I override the "sDom" property using $.extend( true, $fn.dataTable.defaults, {"sDom": "T"}}); for example.
The problem is that when I have TableTools as a default "sDom" option, I get this error if I don't explicitly initialize dataTables with a config object. So calling $('#some_table').dataTable(); results in the error above. If I call it with $('#some_table').dataTable(); there's no error.
It's a rather minor bug but the source of the problem suggests that TableTools expects the dataTable to explicitly have that configuration object at all times, even before dataTables actually generates it when the initialization doesn't include it.
Hope that makes sense, if you need more information just ask.
When I attempt to initialize a table with .dataTable(); and no other arguments (all defaults) I get an error:
"Cannot read property 'tableTools' of null"
The source of this error is based on how I have dataTables defaults configured. I override the "sDom" property using $.extend( true, $fn.dataTable.defaults, {"sDom": "T"}}); for example.
The problem is that when I have TableTools as a default "sDom" option, I get this error if I don't explicitly initialize dataTables with a config object. So calling $('#some_table').dataTable(); results in the error above. If I call it with $('#some_table').dataTable(); there's no error.
It's a rather minor bug but the source of the problem suggests that TableTools expects the dataTable to explicitly have that configuration object at all times, even before dataTables actually generates it when the initialization doesn't include it.
Hope that makes sense, if you need more information just ask.
This discussion has been closed.
Replies
Allan
https://www.drakej.com/datatables.html
So a bug in TableTools which should handle both forms. Fix is committed here: https://github.com/DataTables/TableTools/commit/6e97760a
And it is now in the nightly. Updated example using 1.9.4 showing it working now: http://live.datatables.net/valugin/1/edit
Thanks again for flagging this up and providing the details!
Regards,
Allan