Two tables with same ID on same page
Two tables with same ID on same page
I am using nested TMPL_LOOP to generate multiple tables , so basically all of them has same id (proctable_head)
I am using dataTable for scrolling in these tables
But due to same id it only initializes the first table.
is there a way to use it for multiple tables?
[code]
[/code]
I am initializing the dataTable as
[code]
$(document).ready(function () {
var tab = $('#proctable_head').dataTable( {
"sScrollY": 430,
"sScrollX": 410,
"bLengthChange": false,
"bPaginate": false,
"bInfo": false,
"bSort": false,
"bStateSave": true,
"bScrollCollapse": true,
"bAutoWidth": false,
"bFilter": false
} );
});
[/code]
I am using dataTable for scrolling in these tables
But due to same id it only initializes the first table.
is there a way to use it for multiple tables?
[code]
[/code]
I am initializing the dataTable as
[code]
$(document).ready(function () {
var tab = $('#proctable_head').dataTable( {
"sScrollY": 430,
"sScrollX": 410,
"bLengthChange": false,
"bPaginate": false,
"bInfo": false,
"bSort": false,
"bStateSave": true,
"bScrollCollapse": true,
"bAutoWidth": false,
"bFilter": false
} );
});
[/code]
This discussion has been closed.
Replies
No - an id must be unique in HTML. To have two identical ids is invalid HTML.
Multiple tables can be initialised by selecting them correctly with a single jQuery selector expression - [for example](/examples/basic_init/multiple_tables.html).
Allan