Trouble Initializing 2nd Table

Trouble Initializing 2nd Table

hcabboshcabbos Posts: 5Questions: 0Answers: 0
edited September 2009 in General
Hi. I'm close to finishing my app but I'm having trouble in initializing my second table (oTable2). I'm using the hide row example from this site as a starting point. Here's what I've got:

[code]/*
* Initialse DataTables, with no sorting on the 'details' column
*/
oTable1 = $('#cliniciansNorthEast').dataTable( {
"aoColumns": [
{ "bSortable": false },
null, null, null, null, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}
],
"aaSorting": [[4, 'asc']]
});

oTable2 = $('#cliniciansNorthEast').dataTable( {
"aoColumns": [
{ "bSortable": false },
null, null, null, null, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}
],
"aaSorting": [[4, 'asc']]
});[/code]

Replies

  • hcabboshcabbos Posts: 5Questions: 0Answers: 0
    edited September 2009
    Let me clarify what I mean…

    In oTable2, there's no pagination; it's unstyled; none of the columns which are specified to be hidden are hidden. However, if I take out the following from oTable2, the table does become styled and becomes sortable:

    [code]"aoColumns": [
    { "bSortable": false },
    null, null, null, null, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}, {"bSearchable": false, "bVisible": false}
    ],[/code]
  • allanallan Posts: 63,564Questions: 1Answers: 10,479 Site admin
    Hi hcabbos,

    At a guess, I would say that the number of columns in your table doesn't match the number of elements in your aoColumns array (10 I think). Could you paste some of your table as well?

    Regards,
    Allan
  • hcabboshcabbos Posts: 5Questions: 0Answers: 0
    Allan, the problem was with the table. It had a few rows that contained fewer columns than was specified in aoColumns. Thanks ;) for all your help!
This discussion has been closed.