Trouble Initializing 2nd Table
Trouble Initializing 2nd Table
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]
[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]
This discussion has been closed.
Replies
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]
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