Issue when using FixedHeader with RequiredJS

Issue when using FixedHeader with RequiredJS

AOzAOz Posts: 3Questions: 0Answers: 0
edited April 2014 in FixedHeader
Hi I've been trying to get the FixedHeader (@version 2.1.1-dev) working with the RequiredJS and keep hitting a roadblocks because fixedHeaders library would always be undefined.

I looked at the code and noticed fixedheaders module is defined using module name.
[code]
define( 'datatables-fixedheader', ['jquery', 'datatables'], factory );
[/code]

As I am a fairly new to javascript and requirejs is new to me, I looked at requirejs documents and found a paragraph where they seem to discourage defining modules with a name http://requirejs.org/docs/api.html#modulename
[quote]
These are normally generated by the optimization tool. You can explicitly name modules yourself, but it makes the modules less portable -- if you move the file to another directory you will need to change the name. It is normally best to avoid coding in a name for the module and just let the optimization tool burn in the module names.
[/quote]

I am sure there is a way to get this code working as is, but I broke my head trying to figure out how, instead I changed the code in dataTables.fixedHeader.js to make it work for me.
[code]
//define( 'datatables-fixedheader', ['jquery', 'datatables'], factory );
define(['jquery', 'datatables'], factory );
[/code]

Thank you for this fantastic tool!

Replies

  • allanallan Posts: 61,035Questions: 1Answers: 9,953 Site admin
    I was going with the same form factor as jQuery. Having it as a named module seemed a lot more tidy, but thanks for flagging this up. I'll look into it.

    Allan
This discussion has been closed.