Why do my child rows not show its contents after using the destroy option?
Why do my child rows not show its contents after using the destroy option?

Good night.
In my code I need to change the contents of the tbody in datatables based on a person's name that is clicked.
Using the destroy option works great i can show different people information and i don't get the cannot reinitialize datatables error. BUT!! when i refresh the page the child rows work perfectly for the person I start with. When i select another person the child rows wont open.
Please let me know how i can fix this issue.
Thank you
This question has an accepted answers - jump to answer
Answers
Hi @dt_user ,
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Ok. I followed the link you provided and I am using live.datatables.net. I placed my code in it. But I can't populate the datatables because I get data from my database.
Do you still want to see the code in live.datatables.net?
Please let me know.
It depends if you want help
Without being able to see the issue, it's hard to make recommendations. Can you link to your page, or abstract the issue to a simple test case on live.datatables.net so we can see the problem? We don't need server data, we just need to see the problem.
ok Colin, I tried to replicate my actual code. The problem experienced here is exactly what I am experiencing now. The only difference is that in my actual code I only have one initialization of datatables that is loaded with different data based on the button pressed. In my example I needed to have two so I could show you how I move between the buttons to load different data in the same DataTable.
The link: http://live.datatables.net/givixejo/1/
Please let me know how I can fix my problem with the child rows not showing for the second person(button).
Thank you.
Hi @dt_user ,
The problem is because you were accumulating the
on
events - the old ones weren't being removed. I added anoff
to remove the previous listeners near the start of yourtab_clicked()
function, and it seems to be doing what you want. See here.Hope that does the trick,
Cheers,
Colin
Thank you so much!!!