Buttons 1.1.0 not load via requireJS

Buttons 1.1.0 not load via requireJS

viandanteviandante Posts: 22Questions: 10Answers: 1
edited December 2015 in Free community support

Hi,

I load the js via requirejs, and i the error:

Uncaught Error: Script error for: datatables.net
Uncaught Error: Script error for: datatables.net-buttons

RequireJS search to load datatables.net.js and datatables.net-buttons.js that not exists.

I have to go back to the previous version?

Thanks

Massimo

This question has an accepted answers - jump to answer

Answers

  • viandanteviandante Posts: 22Questions: 10Answers: 1
    Answer ✓

    I solved by changing the source of all extensions with my requireJS structure.

  • nerdybynaturenerdybynature Posts: 2Questions: 0Answers: 0

    Hi viandante!
    Do you mind explaining what you did?

    I've tried the following with and without the 'https:':

    paths: {
          dtSelect: "https://cdn.datatables.net/select/1.1.2/js/dataTables.select.min",
          dtButtons: "https://cdn.datatables.net/buttons/1.1.2/js/dataTables.buttons.min"
    },
    

    and I've tried the following, also with and without 'https:':

    require(["https://cdn.datatables.net/select/1.1.2/js/dataTables.select.min", "https://cdn.datatables.net/buttons/1.1.2/js/dataTables.buttons.min"], function(){})
    

    But I can't seem to get it to work.

    Appreciate any help!

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    What errors are you getting? Can you link to a test page showing the issue please?

    Allan

  • nerdybynaturenerdybynature Posts: 2Questions: 0Answers: 0

    Hi Allan

    Sorry for the late reply, didn't get an email notification about your post.

    The error i kept getting after I tried to include the extensions was

    Uncaught Error: Script error for "datatables.net"
    http://requirejs.org/docs/errors.html#scripterror
    

    What I had to to was to change the way I included the main datatables.min.js.
    From just doing:

    requrie([ ... , "vendor/datatables.min", ...]. function(){ ... }
    

    to:

    require.config({
        ...
        paths: {
            "datatables.net": "vendor/datatables.min"
        }
        ...
    });
    
    require([ ... , "datatables.net", ...]. function(){ ... }
    

    And now it seems to work! :)

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Great to hear you got it working - thanks for posting back!

    Allan

This discussion has been closed.