Issue when using FixedHeader with RequiredJS
Issue when using FixedHeader with RequiredJS
AOz
Posts: 3Questions: 0Answers: 0
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!
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!
This discussion has been closed.
Replies
Allan