DataTable not working :/

DataTable not working :/

jacobsonjacobson Posts: 3Questions: 0Answers: 0
edited November 2012 in General
Hello there, I just downloaded the datatables and wante to implement on my website...
I added the css and js files :
[code]



[/code]

i have my table

[code]



123



<?php
foreach($items as $item):
?>

<?php echo $item->1; ?>
<?php echo $item->2; ?>
<?php echo $item->3; ?>

<?php
endforeach;
?>


[/code]

just after that I added

[code]
$(document).ready(function() {
$('#mytable').dataTable();
});
[/code]

It doesnt work ... and I dont know why because I think I did everything ...
When I inspected the website it showed one error when loading script:
http://screenshotuploader.com/s/01/izh-a1qi9

Replies

  • allanallan Posts: 63,230Questions: 1Answers: 10,416 Site admin
    Your HTML is invalid - there is no TR element in the THEAD, which is required for both HTML and DataTables (DataTables assumes valid HTML at all times).

    Allan
  • jacobsonjacobson Posts: 3Questions: 0Answers: 0
    Oh sorry I just missed the tr here but i Have those in my code
  • allanallan Posts: 63,230Questions: 1Answers: 10,416 Site admin
    edited November 2012
    In that case we'll need a link to the page to see what is going wrong, as that all looks fine.

    Allan
  • jacobsonjacobson Posts: 3Questions: 0Answers: 0
    http://debug.datatables.net/izicic
  • allanallan Posts: 63,230Questions: 1Answers: 10,416 Site admin
    Your table appears to have 10 columns - but the code you pasted above only has 3?
This discussion has been closed.