Set a class to the Editor Modal or attach it to a specific container
Set a class to the Editor Modal or attach it to a specific container
Hi,
I have been through the forum for an answer and found some interesting infos.
In my project I need to edit the modal generated by the Editor. Actually when it pops up it is attached directly to the body of my document. If I change any setting directly on this modal it will affect others and this I don't want.
Therefore I look for a way to add a class to it / attach it to a specific container when it opens.
I've read this very interesting post :
https://datatables.net//forums/discussion/comment/93649/#Comment_93649
and found out about this :
$.fn.DataTable.Editor.display.bootstrap._dom.content
So far the first solution doesn't really fit, I have plenty of tables and just want to edit the modal of a specific one.
For the second, I confess I have no idea if I can do what I want with it.
By advance many thanks for your ideas,
Sébastien
Answers
$.fn.DataTable.Editor.display.bootstrap.node()
will give you the modal node - so you could use:This is assuming you are using Bootstrap styling.
Allan
Thumbs up! Many thanks Allan!
Usage of
$.fn.DataTable.Editor.display.bootstrap.node()
throws error in version 1.9.1 editor.bootstrap4.min.jsHi @admin_atyantik ,
I'm seeing that too! I've raised it internally (DD-1187 for my reference) and we'll report back here when there's an update.
Cheers,
Colin
Hi @admin_atyantik,
Thanks for noting that. This change comes from the fact that there is now a Bootstrap model per Editor instance. So what you need to do is pass the Editor instance into the
node()
function - e.g.:And that will give you the node for that specific instance of Editor.
Regards,
Allan
Ah I see. Thank you, I'll update my workaround with this update.