I saw that there was a similar question to which I was working in Stack Overflow, Getting the initialisation object from DataTables, I planned to expand this to suit the questions' needs as I am linking it to the question as well.
- Create an initialisation object and store globally.
- Initialise the DataTables with the global object.
- Kill the DataTables using the
- Initialise with the same initialisation object defined in the first method.
This solution is totally absurd considering the way, the DataTables are initialised and rendered in my application. My proposed solution to my manager was something different. Why not apply the transformation before the DataTables are initialised?
But unfortunately, corporate guidelines do not allow the core code to be changed by the newbies!
The reply was kind of baffling but I have to accept as these are the worst scenarios for developers working in a corporate environment, where the code is managed by literally hundreds of team members! So, I thought of using my other method.
From the manual of
DataTable().init(), it does have an option. The following function gives us an approximate initialisation object:
Although, this will not give you the exact initialisation object that we have used it when we initialised it, at least we can get to make the same DataTable configuration as how it was before it was killed. A CodePen to demonstrate the same is as follows:
I hope this helps someone. As usual, if you have a better solution or any suggestions, please do pen down in the comments. Thanks.