Datatables works perfectly but with Trial of Editor table disappears

Datatables works perfectly but with Trial of Editor table disappears

Joegrammer123Joegrammer123 Posts: 1Questions: 1Answers: 0

How do I know that the Editor JS I downloaded is working, and not already expired?

I have been using Datatables for a few years now, just fine, but when I added Editor to be able to let users change a few fields in the table, the table disappears when I introduce the new code. If I comment out the code, the table appears, but when I put the Datatables.Editor() call back in, it disappears.

Test without Editor: https://danielsstoretest.infinitybuss.com/pgs/Tester.aspx (ignore the cert errors, its a test site)
Test With Editor: https://danielsstoretest.infinitybuss.com/pgs/Tester-Editor.aspx (same page with .Editor uncommented)

I know it's ugly, because I have a Foundation site and this example is a strippy from the big page, but it's only to demonstrate my problem. As soon as I introduce Editor, the table disappears. I have spent a dozen hours this week trying everything. I would really like to use Editor, but I need to see it working first. I only downloaded the Editor files on 09/02/2024 - so it's only been a week. It shouldn't be expired yet.

Any ideas? I really appreciate your time.

-Joe

Answers

  • kthorngrenkthorngren Posts: 21,449Questions: 26Answers: 4,975

    You are getting these errors in the console:

    Uncaught TypeError: Cannot read properties of undefined (reading 'Api')

    Uncaught TypeError: DataTable.Editor is not a constructor
    at Tester-Editor.aspx:38:24

    This is your script load order:

        <script src="../bower_components/jquery/dist/jquery-3.7.1.min.js"></script>
        <script src="../bower_components/Editor-2.3.2/js/dataTables.editor.min.js"></script>
        <script src="../bower_components/DataTables-2.1.6/datatables.min.js"></script>
        <script src="../bower_components/Editor-2.3.2/js/editor.dataTables.min.js"></script>
    

    I think you need to load Editor after loading datatables.min.js, for example:

        <script src="../bower_components/jquery/dist/jquery-3.7.1.min.js"></script>
        <script src="../bower_components/DataTables-2.1.6/datatables.min.js"></script>
        <script src="../bower_components/Editor-2.3.2/js/dataTables.editor.min.js"></script>
        <script src="../bower_components/Editor-2.3.2/js/editor.dataTables.min.js"></script>
    

    See if changing the order helps.

    Kevin

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin

    To answer this specific question:

    not already expired?

    It will show an alert() if it has expired. There is also a countdown in the browser's console from 7 days to go.

    As Kevin says, I think the error you are seeing is caused by a loading order.

    Allan

Sign In or Register to comment.