Want to trace into Datatable initialization to find out how settings gets built
Want to trace into Datatable initialization to find out how settings gets built
I have been using DataTables successfully for a while now, and I am adding a new feature where the user flips the table. I have my data in JSON, and I flip the data, then I redraw the table. The table looks good, but when I go to reinitialize the DataTable object, I set some breakpoints in the code and looked around. In the settings object, it is clear I have dropped a column somehow.
I do an oTable.destroy(), then I force a resize (to clear some artifacts that are left over) and then I restart things with:
oTable = $('#lynx_table_1').DataTable(defaultOptions);
Now, I realize that calling destroy() might be somewhat out of the ordinary, but after all I did flip the table.
So my defaultOptions I passed in are good, but since I am still somewhat new to javascript, I am a bit out of my league.
I want to trace into where I reinitialize with the line above, but F11 in the chrome dev tools takes me into jquery first.
My goal here is to see where the settings are built, because in there I can see that I have dropped a column somewhere.
Eyeballing the output html, things look good, so I want to dive in.
Can someone point me in the right direction?
A newbie thanks you...
This question has an accepted answers - jump to answer
Answers
This is where the settings object is initially built. Then the following sections of the code there map the user configuration options on to the settings object (they aren't always 1:1 which is why that is needed).
Out of interest, how are your flipping the table?
Allan
Thanks Allan -- I'll go look there today.
My data model for the table I render has individual entries for each table entry, and has the row and column stored there. All I have to do is swap the row and column entries to flip the table.
Thanks for your help Allan. I found the issue.
To get the table removed from my page, I do a destroy(), and then I call a function that I use when the user resizes the page.
This is my first time using destroy() and starting over, so I am getting used to the side effects of that.
I had been deleting the thead and tbody from my page before I called those two methods, but one of those two calls was putting a "ghost" thead back in the dom. I delayed my dom cleanup to after doing the destroy()/resize(), and it all works now.
Thanks again!