Child/Details Row Displaying as 'row' in Chrome
Child/Details Row Displaying as 'row' in Chrome
I've got a table where all the details rows are supposed to be visible under certain conditions. I generate the regular rows and the details rows in the code behind, attaching the details row by adding it as an attribute to the regular row as a string (which contains formatted html). Like so:
for each record...
StringBuilder sb = new StringBuilder();
HtmlTextWriter htw = new HtmlTextWriter(new System.IO.StringWriter(sb, System.Globalization.CultureInfo.InvariantCulture));
holderRow.RenderControl(htw);
string html = sb.ToString();
tr.Attributes.Add("child-value", html);
table_body.Controls.Add(tr);
And this works just fine in IE. But in Chrome, the details row shows none of the details. It only shows 'row' (see attached 'example.PNG').
Here's my js to show all the details rows:
function CreateDataTableWithDetails() {
var table = $('#tableConferenceRoomReports').DataTable({
dom: 'rt',
paging: false,
order: [[6, 'asc'], [1, 'asc'], [0, 'asc']],
stateSave: true
});
table.rows().every(function () {
var tr = $(this.node());
for (var i = 0; i < tr.context.attributes.length; i++) {
if (tr.context.attributes[i].name == 'child-value') {
this.child(tr.context.attributes[i].value).show();
}
}
});
I've confirmed that the 'value' attribute does in fact contain the child-data attached in the code behind ('nodeValue' and 'textContent' have the same data). And, like I said, it works fine in IE. Any idea what I'm missing?
This question has an accepted answers - jump to answer
Answers
bumpity.
Have you looked at the raw html generated by your server side code? Unfortunately, I have found IE to be more "forgiving" on html such as missing closing tags, etc than Chrome so things that worked in IE didn't in Chrome
Could you show us a console.log of
tr.context.attributes[i].value
?Allan
Well, with absolutely no changes, it seems that it's working fine today.
Here's the console.log of tr.context.attributes[i].value, in case anyone can spot what would make the issue come and go.
Possibly some old cached file that has been cleared out by the browser now?
Either way, good to hear that it is working now.
If you run into the issue again, I think we'd need a link to a test case showing the issue to be able to debug it.
Allan