unable to extract child row values
unable to extract child row values
https://jsfiddle.net/1k8et0sd/8/**:
**Debugger code (debug.datatables.net):
Chidl rows returning NaN:
Description of problem:
Hi Please see my fiddle here : https://jsfiddle.net/1k8et0sd/8/
For the life of me I can not figure out why 'data-child-value' values are not passing on to format function.
Appreciate your input.
AP
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You are trying to use the jQuery data() method which doesn't expect the leading
data-. I think this is what you want:Updated example:
https://jsfiddle.net/12ubaLd9/
Kevin
Oh my goodness! Thanks for your help!
HI Kevin.
Me again. How do I add conditional styling (based on regex such as cell value is PASS, FAIL etc )to child table cells. I am looking to add text background color
Use
createdRowas shown in this example.Kevin
I can't quite get it. Could you please help.
Please see updated fiddle here:
You are running
$('#mchild').DataTable({when the page is loaded, rather than when the child row / table is created. As such, the child table isn't found, and thus can't be created as a DataTable.You need to run the initialisation for the child table after you insert it into the document - i.e. after the
row.child(...).show()call.I would suggest you create a function that will initialise the inner table, and pass in the inner table node, rather than using an id (since an ID must be unique on a page, and if you showed two child tables at a time, that would break at the moment).
Allan
Hi Allan and Kevin,
Thanks for taking time to help.
I followed another lead from this forum to achieve what I am looking for.
Example here.
I have one more question though.
I would like to append couple of rows ( csv ) or inner html text perhaps when exporting table in excel format. I am using buttons and following customize function. How do I append content to last row?
Alternatively, is there a way to have hidden rows in a dateable and be able to export?
customize: function ( xlsx ) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
$('row:first c', sheet).attr( 's', '2' ); // bold header row
var attr = $('row', sheet).length;
attr.append( 'Gene,Target,Mean Coverage' ); // this is right syntax?.
}
The easiest way to append rows to the bottom is to use the
messageBottomoption. See this example of usingmessageTop. You can do the same withmessageBottom.Kevin
Hi Kevin,
please see the code below.
message bottom row is spanning across table columns. How do I make them as individual rows.?
Data is center aligned. How do I make it left aligned?
You'd need to use the
customizecallback of theexcelHtml5button type to modify the XML that is created for the output. For that you'll need:It exporter isn't really designed for easy modification - that would be a whole project in and off itself. SheetJS for example might be of interest if you need "real" customisation of the Excel export beyond fiddling with some XML.
Allan
Sure. I understand.
Left aligning the message bottom would work for me. How do I do that?
Apply style
50to the cell in question. The example shows how to set style2to all cells for a particularly column. You'd need to use a selector that picks out the specific cell you want - possiblyrow:last-child c, but I haven't tried it.Allan