pre-existing span within the header - need to target datatables inserted span
pre-existing span within the header - need to target datatables inserted span
luke.charde
Posts: 1Questions: 0Answers: 0
I have had the issue of our framework (JSF) adding spans within the table header - sometimes this cannot be prevented. Datatables inserts spans into the header and then targets them for sorting. The pre-existing spans are also being acted upon by Datatables.
@Allan, There may be a much more elegant way to fix, but here is what we did. Would a fix for this type of situation be something that could be rolled into Datatables?
Line 2947
[code]
var sortSpan = document.createElement( 'span' );
sortSpan.className = "sortHeaderSpan";
nDiv.appendChild( sortSpan );
[/code]
line 4644(4646)
[code]
var jqSpan = $("span.sortHeaderSpan",
oSettings.aoColumns[i].nTh);
[/code]
@Allan, There may be a much more elegant way to fix, but here is what we did. Would a fix for this type of situation be something that could be rolled into Datatables?
Line 2947
[code]
var sortSpan = document.createElement( 'span' );
sortSpan.className = "sortHeaderSpan";
nDiv.appendChild( sortSpan );
[/code]
line 4644(4646)
[code]
var jqSpan = $("span.sortHeaderSpan",
oSettings.aoColumns[i].nTh);
[/code]
This discussion has been closed.
Replies
This really is not a minor bug, either. Using a plain, generic tag in something like dataTables easily leads to errors like this quite easily. This should be fixed.