colspan on dynamically loaded content
colspan on dynamically loaded content
kiwis
Posts: 15Questions: 10Answers: 0
I'm using this approach
https://datatables.net/forums/discussion/comment/190137/#Comment_190137
And I have two for loops into my fetch result.
First one is a head row. Second one is my normal data.
Currently all is going well. My issue is on my head template I can't have
<script id="refRow" type="text/html">
<tr>
<th colspan="4" data-order="{{Surname}}">{{personName}}</th>
</tr>
</script>
In my HTML I have this
<thead>
<tr style="display:none;">
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
Any ideas, options?
This discussion has been closed.
Answers
this is the error
jquery.dataTables.js:3140 Uncaught (in promise) TypeError: Cannot set property '_DT_CellIndex' of undefined
at _fnCreateTr (jquery.dataTables.js:3140)
at _fnAddData (jquery.dataTables.js:2453)
at HTMLTableRowElement.<anonymous> (jquery.dataTables.js:2481)
at jquery.min.js:2
at Function.map (jquery.min.js:2)
at S.fn.init.map (jquery.min.js:2)
at _fnAddTr (jquery.dataTables.js:2479)
at _Api.<anonymous> (jquery.dataTables.js:8233)
at _Api.iterator (jquery.dataTables.js:7068)
at _Api.<anonymous> (jquery.dataTables.js:8231)
That error is normally generated when the column count in the header and body and data don't match - so that would be the place to start.
If that doesn't solve it, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin