I am wondering if the child rows could be implemented as datatables themselves, this way beeing able to cascade to as many drilldown subreports (tables).
Yes, there have been some threads on this subject in the forum. Take a look if you need more details.
Here is a simple example:
It is very rudimentary and is not the best example. One problem with it is it uses the same id for each child Datatable. But it may give you a starting point.
Hi @raduborcan ,
Yep, as Kevin said, it's been mentioned a few times. See this thread here, that should help,
For me it doesn't work as expected. It shows 3 pairs of identical lines for every child record and above all I cannot figure out how to implement when I have more then one record of child rows (could be hundreds of rows).
Also I cannot image how can I create for every child row another child rows (something like imbricated drill down subreports).
Here is a long winded thread regarding another who wanted multiple levels of Child Rows containing Datatables. The thread discusses some promises issues but I ultimately put this example together using ajax calls to get the data for each Child Row:
It utilizes for loops to filter down the data just for the example. If you use ajax calls for the child I suspect you will filter them at the server.
Again this is just a demo and utilizes the same table ID for each level of children.
If you have further questions please post an example of what you are doing so we can help.
I would like to see the data (/ajax/objects.txt) to figure out a more complex example.
The second child doesn't resize the viewport as it does the first one, even the script are identical for both... any clue why?
Is any posibillity to align the childs' fileds with their parents?
If you just view http://live.datatables.net/ajax/objects.txt you'll get that file. The viewport resize would be specific to Kevin's example/implementation - if you look at the thread I posted above there's another example where that resize doesn't happen.
Thank you for the file, but I cannot see how you can scale up for more child records; I've tried putting 3 recs for "extn", but it keeps taking the last one.
I suppose I have to iterate through the recs somehow, but I don't know how.
Without seeing what you are trying to do its hard to say specifically. There is nothing special about Datatables displaying in a child detail row. You add data to it the same as any other Datatable. You could simply structure your ajax option to request the desired data (using ajax.data and let it populate the table as usual. Since I don't control the server script in my example I needed to use ajax as a function just for the demo.
Again it depends on the data structure you are receiving and how you want it displayed.
Sorry for delay, finally I have some time to test your example.
I simply added two more rows with "extn" with different values, but it shows only the last value of the field. It appears it ignores the other first two; I suppose it would shown 3 rows with "extn" and their different values.
Any idea ?
Hard to say without seeing your code. Please post a test case showing the issue so we can help debug.
I didn't make any code, just copied yours from http://live.datatables.net/nokeduka/1/edit and in the "objects.txt" file I put 2 more line as I described in previous post. So all the code is there.
Its probably the for loop is no picking up all the rows. I suggest adding console.log statements in the for loop to help debug why its not getting 3 rows of data.
I'm not able to update the objects.txt that is used for the live.datatables.net examples but I did modify the code to display child rows of all records that match the position column. This appears to work and displays multiple rows.
I built the example this way because I don't have control of the server scripts and data. It fetches all the data with the child ajax request. In production you probably won't have the child request all the data but filter it using the ajax data option and eliminate the for loop.
It looks like you're new here. If you want to get involved, click one of these buttons!
DataTables designed and created by SpryMedia Ltd.
SpryMedia Ltd is registered in Scotland, company no. SC456502.