Edit JavaScript code without editing source code
Edit JavaScript code without editing source code
I have this code in datatables.js for example
$.extend( true, DataTable.Buttons.defaults, {
dom: {
container: {
className: 'dt-buttons btn-group flex-wrap'
},
Now I need to delete/remove btn-group and flex wrap without editing the source code. I need to do that with both JavaScript and CSS if possible and then I'll choose which to choose. How can I do that?
This question has an accepted answers - jump to answer
Answers
One option might be to use
button().node()
orbuttons().nodes()
along with jQuery removeClass() to remove the classes. UseinitComplete
for this.Kevin
@kthorngren Can you please write an example code for the code that I wrote above so I can understand, because I am not that good in JavaScript
I see that default is actually setting the class to the
div
the buttons are in not the buttons themselves. In this case you can use a simple jQuery statement:For example:
http://live.datatables.net/jovifiha/1/edit
Kevin
Another option:
before your initialise the DataTable (but after you import the JS files).
Allan
I see the code snippet in the first post is in the Datatables libraries not the code the OP created. Allan's suggestion would be like my test case except you remove the classes you don't want and ignore the
initComplete
code.Kevin
@kthorngren Nice! It worked perfectly! Now when I export as pdf, the Arabic letters transform into like rectangle shape/symbol. I don't have issues when I open Arabic pdfs in general, the issue is only when exporting tables as pdf using datatables. https://datatables.net/forums/uploads/editor/sz/gsfnof4xk6rr.png
That'll be the fonts - see this thread, as it's discussing that,
Colin
@colin Sorry it is complicated, can you please help me more, I'll send live.datatables link with my code. Please tell me or edit my code on there. http://live.datatables.net/neqemevi/1/edit