requirejs & datatable

requirejs & datatable

sadmarksadmark Posts: 1Questions: 1Answers: 0

while I were using requirejs and dataTables to build a website, I got some problem.

I went to see the source code about datatables.

    if ( typeof define === 'function' && define.amd ) {
    // AMD
    define( ['jquery', 'datatables.net'], function ( $ ) {
        return factory( $, window, document );
    } );
}

where can I find the 'datatables.net' module?

I find all dirs but failed.

Could you show me the way?

thank you.

Answers

  • allanallan Posts: 62,315Questions: 1Answers: 10,225 Site admin

    You need to use your Require config to specify where the datatables.net module is. For example:

    require.config( {
        paths: {
            'datatables.net': '//cdn.datatables.net/1.10.12/js/jquery.dataTables'
        }
    } );
    

    Allan

This discussion has been closed.