problem using datatables in moodle plugin working with xampp

problem using datatables in moodle plugin working with xampp

ofricaspiofricaspi Posts: 2Questions: 1Answers: 0
edited March 2023 in Free community support

Hey everyone,

I've been having this problem for over 2 months. For some reason, I can't render the DataTables like it should render and I always get an error saying:

My code looks like this:

**my_datatables.js:

**// The core/tree uses jQuery to expand all nodes.
define([
    'jquery',
    'local_news/jquery.dataTables'
], function($) {
    return {
        init: function () {
            $(document).ready(function () {
                $('#newstable').DataTable({
                });
            });
        }
    };
});

And I have another file called jquery.dataTables.js which I copied from a colleague. I made an amd directory and did the Grunt action and created a min.js for both of the files.

I'll be glad for any kind of idea or help, I'm losing my mind. Thanks to everyone who helps. :)

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Can you link to a test case showing the issue please?

    Thanks,
    Allan

  • ofricaspiofricaspi Posts: 2Questions: 1Answers: 0

    its a bit of a problem becuase the test case is related to html, js, and css and im working with php and mustache files.
    i uploaded it all to my git :
    https://git.devlion.co/ofri/news_plugin/-/tree/master/local/news

    the problem is that for some reason the datatable.js is not even shown in the sources when i do inspect :

    thank you so much for trying to help :)

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    That repo apparently needs a sign in. However, I'd really need a link to a running page showing the issue to be able to determine what is going wrong. I'd need to see how Require.js's paths / aliases are setup for example, any errors in the console, the rendered HTML, etc.

    Allan

Sign In or Register to comment.