Html Table header disappears

Html Table header disappears

WouterVos87WouterVos87 Posts: 2Questions: 0Answers: 0
edited February 2010 in General
Hi guys,

I'm trying to use the dataTables.min.js on my table but when I load the header, it's gone, thus causing errors.

The error that is generated:
DataTables warning: Unexpected number of TD elemtents. Expected 8 and got 16. DataTables does not support rowspan/colspan in the table body, and there must be one cell for each row/column combination.

As you can see below, when I view the source, the and are missing.

Codefront that I used:
[code]
var oTable;
$(document).ready(function () {
oTable = $('#ctl00_ContentPlaceHolder1_emailMessageTable').dataTable(
{
'bAutoWidth': false,
'bSort': true,
'bFilter': true,
'bSortClasses': false,
'aaSorting': [[0, 'desc']],
'iDisplayLength': 25,
'bPaginate': true,
'sPaginationType': 'full_numbers',
'bProcessing': true,
'sDom': '<"top"f>rt<"foot"pi><"clear"l>',
'bSearchable': true,
'bSortable': true,
'aoColumns': [{ "sWidth": "80px", "bSearchable": false },
{ "sWidth": "80px", "bSearchable": false },
{ "sWidth": "120px" },
{ "sWidth": "100px" },
{ "sWidth": "40px", "bSortable": false, "bSearchable": false },
{ "sWidth": "40px", "bSortable": false, "bSearchable": false },
{ "sWidth": "40px", "bSortable": false, "bSearchable": false },
{ "sWidth": "40px", "bSortable": false, "bSearchable": false }
]
});
});
<!-- Defining my table -->











[/code]

Code that I get when viewing the source:
[code]

Verzend Datum
Herrinerings Datum
Naam van het onderzoek
E-mail onderwerp
Reactie Aantal
Verzonden Aantal
Zend Vervolg
Details


3-11-2006

Cursistenprofiel Transfergroep Rotterdam
Cursus Transfergroep Rotterdam
31
51




[/code]
Does anyone know why/how this happens and how this can be prevented? Thanks in advance.

Edit: removed part of the code that was not relevant for this problem, i hope...

Replies

  • WouterVos87WouterVos87 Posts: 2Questions: 0Answers: 0
    An idea of mine is to use a gridview to store the data and let the js work on that.

    But this gives me the same problem, the header (while I specifically assigned it) turns into a normal data row.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi WouterVos87,

    I'm afraid I don't know ASP at all, so I doubt I can help, other than to say that the thead and tbody are absolutely required by DataTables. If ASP is stripping them (which is very odd - I know others have successfully used DataTables with ASP) then its going to fail.

    I'd suggest disabling DataTables just now, and trying to get the required output from ASP (perhaps post on an ASP specific forum). Once that is done, re-enable DataTables and that should be it :-)

    Allan
This discussion has been closed.