Would DataTables prevent custom modals to be shown?
Would DataTables prevent custom modals to be shown?
Hi all,
I've implemented DataTables and I really love it, but is it possible that DataTables DOM manipulation causes my custom modals not to be shown after clicking a button?
I have Delete buttons which trigger custom modal display and prevent default actions until the user decides.
When landing on the page these work, but after pagination or filtering these actions are not triggered. The records simply gets deleted, which is really dangerous.
Am I doing something wrong?
thank you.
seba
This question has an accepted answers - jump to answer
Answers
I think I've localized this to pagination. After filtering, the modals work. After paginating, it doesn't.
I think this will solve my problems:
http://stackoverflow.com/questions/34858738/datatables-jquery-click-event-not-working-after-pagination
Will post here after I can confirm it.
We'd need to be able to see your code to be able to understand what is causing the issue. Possibly you aren't using a delegated jQuery event?
Allan
I apologize. Here's the code:
After pagination the click event on
'.confDelConf'
is no longer triggered.However I think I need to change it to:
Yes, the change looks good to me. The jQuery docs about event delegation are good.
If that isn't working, it suggests that there is no
.confDelConf
class element inside themyTableId
element.Allan
I confirm that the specified change has solved my issue.
Thank you for your confirmation.