Parent / Child editing
Parent / Child editing
RichJCG
Posts: 12Questions: 3Answers: 0
I have implemented a parent / child scenario based on this https://datatables.net/blog/2016-03-25
It's working as expected except for when I click from row to row. At times it does not render at all, yet the data has been returned when I check the response from server.
Realizing the blog above was posted several years ago - maybe there are some updates that could make this more reliable?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I use that example for a couple of my pages and I don't have issues. I can go from row to row and the child table updates correctly. WE would probably need to see your code. Can you provide a link to your page or a test case?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Currently hosted on my local computer. It's a fairly complex setup (or I think so anyway) with codeigniter, foundation, and datatables.
I'll see if I can get something setup on live.datatables that resembles what it is.
Maybe you can just start with the relevant JS code and an example of what is returned for the child row.
I would look for any other functions that you aren't expecting to run that might clear the table. Maybe something is causing the parent row to be deslected and executing this code from the example:
Kevin
Similar to what original codes was - except I have to go one level deeper to get the id.
On select I get the following data for the staffTable and it loads
On deselect or selecting another row I get this
If it's another row I get two calls - one clearing the table and one with the same as initial select above. It typically goes several times just fine, and then doesn't load the data, although I still get the proper data returned in the response.
This was what was returned on the 4th reload but didn't load.
When this happens the staffTable says "No Matching Records Found", which is also what is shown when nothing in the projectTable is selected. If it doesn't have data it says "No data available for this table".
Again - this is more of an annoyance than anything. Concern that users will not see data and will start adding more.
The "No Matching Records Found" indicates to me that you have some sort of search applied to the child table. Does the child table info show something like this:
Showing 0 to 0 of 0 entries (filtered from 1 total entries)
EDIT: In my case when no data is retrieved for the child table I see "No data available in table".
Kevin
When it hangs up it shows
"Showing 0 to 0 of 0 entries (filtered from NaN total entries)". Again - when looking at response from server it does show the data just doesn't render.
When no data the child table shows the same as you show.
This is the child table config
You have
serverSide: true,
set for your child table. Is your server script setup for server side processing? Maybe thats why you are getting theNaN
in thefiltered from NaN total entries
.Definitely looks like you have some sort of search applied to that table. Do you have any custom search functions or APIs configured?
Kevin
Missed that - certainly not something I need for that table. I have it setup for serverside on the main table and had copied the basic config over.
Seriously... kicking myself for not seeing that.
Thank you so much for that and for taking the time.