Why does a table reload closes the child row of the parent table?
Why does a table reload closes the child row of the parent table?
princeofnaxos
Posts: 26Questions: 9Answers: 0
I have a table (T1) and when I click a row, in the child another table (T2) is displayed. Now when I reload T2 with T2.ajax.reload(), it is not redrawn, but T1's child row gets closed. The row in T1 is still marked 'selected', which gives me the impression that the child row was not closed normally, but plainly removed from the DOM.
What exactly happens with a reload? Why is it affecting parent elements of the wrapper? It seems to me that an incorrect DOM element is selected.
This discussion has been closed.
Answers
If I rename the root of the child row (
<tr>
) in Inspector to<div>
and then initialize the table, then the child row is not removed....I don't understand why that would happen I'm afraid. If you were to reload T1, then yes, that would make sense, but not T2.
If you link to a test case showing the issue I'd be happy to take a look.
Allan
Hmm, neither do I. I set up a test page with three nested tables and it works fine there.
I have the feeling that there is some javascript from another library is causing this. Funny thing is, that the table is visible shortly when initializing it.
'draw.dt' is fired, and then it suddenly disappears.
I put an alert on the 'draw.dt' event, and while the popup message is visible, I see the table, saying "Loading". When I click away the alert, the child row disappears.
What happens after the event is fired?
After a good nite's sleep, I continued searching for what was causing this behaviour. And I found it. Well, kinda, I merely located it.
I was using https://cdn.datatables.net/v/bs/dt-1.10.16/r-2.2.0/sl-1.2.3/datatables.min.js from the CDN. When I took out the Responsive module, my problem was gone.
I don't really liked the Responsive module anyway. I'd rather hide columns myself based on the screen size.
There is a bug in Responsive 2.2.0 whereby it will cause an extra redraw. That is resolved in the nightly. But I don't understand why that would cause a parent table to redraw from a client-side table. There might be an event listener for the draw happening - I'm not sure.
If you did want Responsive, then trying the nightly would be worth giving a go.
Allan