The example code not taking effect
The example code not taking effect
Hi,
I am new to JQuery and DataTables, and I am trying to implement the first - zero-conf option - and it is not working - I am reloading the page, but the table looks the same as before and no new features.
Here is my markup:
[code]
<!-- JavaScript, JQuery, DataTables, etc. -->
$(document).ready(function() {
$('#myTable').dataTable();
} );
Insert title here
#
%
#
%
#
%
#
%
Some Link
Total:
[/code]
I am new to JQuery and DataTables, and I am trying to implement the first - zero-conf option - and it is not working - I am reloading the page, but the table looks the same as before and no new features.
Here is my markup:
[code]
<!-- JavaScript, JQuery, DataTables, etc. -->
$(document).ready(function() {
$('#myTable').dataTable();
} );
Insert title here
#
%
#
%
#
%
#
%
Some Link
Total:
[/code]
This discussion has been closed.
Replies
Your initialisation code looks okay, so there much be a Javascript error somewhere (unless the JS isn't being loaded). Having a look in Firebug will confirm this.
My guess at the error is that the header you have is quite complex. DataTables requires a single 'unique' TH element for each column. You can't have more than one unique TH element (something that I will try to address in future), but in your first column, you have two. I'd suggest reducing the complexity of your header to see if you can get that to work, and then let me know what happens.
Thanks,
Allan
Yes, the extra header was causing PART of the problem. The code I posted above is from a JSP, generated using Spring frameworks and JSTL tags. I created a very simple one to test, and replicated the JS code in it - it works fine. Adding the extra header did cause an issue, but after removing it from both the experimental file (which works), and the actual file (which doesn't), the actual file still didn't work
So it doesn't work even with a simple header? You have 11 columns in your table - if you just put in 11 TH elements and one TR in THEAD, does that work? This should! Beyond that, it think it's down to the complexities of the header... I'm looking at the code for that just now, but can't promise anything yet. Also, you might find this demo interesting: http://datatables.net/examples/advanced_init/complex_header.html
Regards,
Allan
It's this entry:
[code]
[/code]
Not certain how, but it was breaking it. After I removed this entry, it works fine
Regards,
Allan