use require.js to load datatables

use require.js to load datatables

xyyl619xyyl619 Posts: 15Questions: 6Answers: 0

when i use require.js to load datatables, all the plugins,such as select, don't init, and it causes select on table don't take effect

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Per the forum rules, please link to a test case showing the issue. We would need to know, at the very least, how you have configured RequireJS and what modules you are loading.

    Allan

  • xyyl619xyyl619 Posts: 15Questions: 6Answers: 0
    edited November 2015

    when i load all plugins one by one ,it works fine.
    but when i load the all-in-one packaged file,it doesn't work.

    here is my require config.

    //"datatables" : "data-tables/datatables",
          "datatables" : "data-tables/DataTables-1.10.10/js/jquery.dataTables",
          "autoFill" : "data-tables/AutoFill-2.1.0/js/dataTables.autoFill",
          "buttons" : "data-tables/Buttons-1.1.0/js/dataTables.buttons",
          "colReorder" : "data-tables/ColReorder-1.3.0/js/dataTables.colReorder",
          "editor" : "data-tables/Editor-1.5.2/js/dataTables.editor",
          "scroller" : "data-tables/Scroller-1.4.0/js/dataTables.scroller",
          "select" : "data-tables/Select-1.1.0/js/dataTables.select",
    

    it works fine.

    but the config below doesn't work.

    "datatables" : "data-tables/datatables",
    //      "datatables" : "data-tables/DataTables-1.10.10/js/jquery.dataTables",
    //    "autoFill" : "data-tables/AutoFill-2.1.0/js/dataTables.autoFill",
    //    "buttons" : "data-tables/Buttons-1.1.0/js/dataTables.buttons",
    //    "colReorder" : "data-tables/ColReorder-1.3.0/js/dataTables.colReorder",
    //    "editor" : "data-tables/Editor-1.5.2/js/dataTables.editor",
    //    "scroller" : "data-tables/Scroller-1.4.0/js/dataTables.scroller",
    //    "select" : "data-tables/Select-1.1.0/js/dataTables.select",
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    The plug-ins will do their own require() - specifically require('datatables.net'); which might be the issue here. It you were to rename "datatables" as "datatables.net" does it then work?

    Thanks,
    Allan

  • xyyl619xyyl619 Posts: 15Questions: 6Answers: 0

    i tried, it doesn't work

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Could you give a link to the page so I can take a look and debug it please.

    Allan

This discussion has been closed.