Datatables not working on my website

Datatables not working on my website

PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1

Hello,
I am having trouble getting DataTables to work on my website, I have tried multiple things, the only way I can get it working is, if I remove my website theme, but I want it to work on my website

Thanks in advanced!
Paul

This question has accepted answers - jump to:

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    You posted the same question last October. It was explained to you then that nobody could debug your code without seeing any of it. Eventually you said the issue was resolved.

    http://datatables.net/forums/discussion/24214/data-tables-not-working#latest

  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1

    Im using the newest version of datatables, i recently updated my website, I have no idea whats wrong with it.
    here is my code http://pastebin.com/bUN6yFKb
    I would have re replied to my old post but thats been closed :(

  • allanallan Posts: 63,700Questions: 1Answers: 10,501 Site admin
    Answer ✓

    Can you link to the rendered page so we can debug it please.

    Allan

  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
  • allanallan Posts: 63,700Questions: 1Answers: 10,501 Site admin

    If you were to open your browser's console you would see an error message that states what the issue is:

    jquery.dataTables.js:40 Uncaught ReferenceError: jQuery is not defined

    Simply put, you need to load jQuery before you load DataTables (since DataTables is a plug-in for jQuery after all).

    Allan

  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    edited August 2015

    I think i have more then 1 jQuery file, 1 for my website theme, another for an editior and one for this, could this be the cause?.

    as i have 2 of them at the bottom of the page in a includes file.

    EDIT: I have added
    ```
    <script type="text/javascript" language="javascript" src="datatables/media/js/jquery.dataTables.js"></script>
    <script type="text/javascript" language="javascript" src="datatables/examples/resources/syntax/shCore.js"></script>
    <script type="text/javascript" language="javascript" src="datatables/examples/resources/demo.js"></script>
    <script type="text/javascript" language="javascript" class="init">

                            $(document).ready(function() {
                                $('#powers').DataTable( {
                                    "lengthMenu": [[100, 200, 300, -1], [100, 200, 300, "All"]],
                                    "ordering": false,
                                    "info":     false
    
                                } );
                            } );
    
                        </script>```
    

    but it still dont work

    EDIT 2: I removed my include files and the datatables now works, But i need tow jquery in that to make my theme work if im not mistaken

  • allanallan Posts: 63,700Questions: 1Answers: 10,501 Site admin
    Answer ✓

    You should only include one jQuery.

    Allan

  • PaulFreeWebsPaulFreeWebs Posts: 63Questions: 4Answers: 1
    edited August 2015

    Hmm, ok So if i move the one up from my site, it should work?

    EDIT: Never mind, i fixed the issue now, thanks for your help, I am now using 1 jQuery

This discussion has been closed.