[closed]Unexpected number of TD elements. Expected 25 and got 24

[closed]Unexpected number of TD elements. Expected 25 and got 24

CasperTDkCasperTDk Posts: 5Questions: 0Answers: 0
edited January 2011 in Bug reports
DataTables warning (table id = 'GridView1'): Unexpected number of TD elements. Expected 25 and got 24. DataTables does not support rowspan / colspan in the table body, and there must be one cell for each row/column combination.

My javascript
[code]var oTable = $('#GridView1').dataTable({

"aoColumns": [

{ "bSortable": false },

null, null, null, null

],

"aaSorting": [[0, 'asc']]

});

new FixedHeader(oTable);
[/code]

the table:
[code]



IDAdresseBeskrivelseBemærkningAnsvarligV

Replies

  • 4giedrius4giedrius Posts: 7Questions: 0Answers: 0
    "aoColumns" arguments number must be the same as columns in your table. There are 5 arguments you passed in "aoColumns" and 6 columns in your table.
  • CasperTDkCasperTDk Posts: 5Questions: 0Answers: 0
    Already tried that. The error changes to: expected 30, got 24
  • 4giedrius4giedrius Posts: 7Questions: 0Answers: 0
    edited January 2011
    Use [code][/code] for your table heading and [code][/code] for content of the table.
  • CasperTDkCasperTDk Posts: 5Questions: 0Answers: 0
    As far as I know. I can not do that.
    The table is written in ASP.net. It is a GridView control.

    Can the issue not be fixed in javascript?
  • solfshrsolfshr Posts: 5Questions: 0Answers: 0
    I also use ASP.NET for some of my projects and here is how I got the GridView set up correctly.

    For your GridView you need to add a PreRender function like this in your code behind file:

    [code]private void GridView_PreRender(object sender, EventArgs e)
    {
    GridView.UseAccessibleHeader = true;
    GridView.HeaderRow.TableSection = TableRowSection.TableHeader;
    }[/code]

    and wire it to your Page_Load function:

    [code]this.GridView.PreRender += new EventHandler(GridView_PreRender);[/code]

    This will give the table the required and tags.

    Cassandra
  • CasperTDkCasperTDk Posts: 5Questions: 0Answers: 0
    It worked. Thank you so much!
This discussion has been closed.