Getting a list of Editors on the page
Getting a list of Editors on the page
Loren Maxwell
Posts: 387Questions: 94Answers: 10
in Editor
I know I can use this function to get a list of the DataTables, $.fn.dataTable.tables()
, but is there an equivalent function to get a list of the Editors?
I've looked through the $.fn.dataTable.Editor
functions but I don't see anything obvious.
This question has accepted answers - jump to:
Answers
Sorry to say, there isn't. The Editor instances do not get stashed in a "store" - they exist only in the scope they were created (and then passed on to), and via their event handlers.
There is an
initEditor
event that Editor fires on the document when an instance is created though. So if you wanted to create such a store, listen for that and add them to the store. One catch there is that there isn't currently a destroy event to match that. Perhaps there should be...Allan
Thanks, @allan -- I think having something would help.
I show a table in the child rows and create a DataTable instance for each child row and an Editor instance for each child row as well, and I currently have to guess if I'm destroying the Editor instances properly.
If I had a way to track all the Editor instances like the DataTables instances then I'd clearly see if I'm doing it correctly.
I think it s a sensible idea. I've added a
destroyEditor
event into thedestroy()
method which will ship in the next release. If you want to use it immediately, add:immediately before
this.dom = null;
in that method.Between this new event and
initEditor
it would now be possible to keep a store of Editor instances on the page.Allan
Perfect! Thanks!