Bug Report: Builder Version # and AMD (RequireJS)

Bug Report: Builder Version # and AMD (RequireJS)

jtfairbankjtfairbank Posts: 4Questions: 1Answers: 0
edited October 2015 in Free community support

I'm using RequireJS to load jquery / bootstrap and recently used your builder (https://www.datatables.net/download/) to remove extensions we weren't using and only include 1 css / 1 js tag.

There's a bug in the built file where the builder version is included as a jquery attribute but the line is not wrapped in AMD code (unlike the main code and all extensions):

jQuery.fn.dataTable.ext.builder = "dt\/dt-1.10.9";

This causes that line to execute before datatables registers itself with jquery. The following error to occurs on load, until I removed that line:

Uncaught TypeError: Cannot read property 'ext' of undefined

Sorry for no jsfiddle- it'd take quite a while to recreate the applications build environment on there. I'm happy to email you the result of my build (and a few others I tested). Just wanted to bring it to your attention. :)

This question has an accepted answers - jump to answer

Answers

  • jtfairbankjtfairbank Posts: 4Questions: 1Answers: 0

    The Main Library - jQuery option is also confusing. The first time I clicked the jQuery 2.x button because that is what I was already including. It was only after other things started breaking that I realized that meant DataTables would include its own copy of jQuery.

  • allanallan Posts: 63,755Questions: 1Answers: 10,509 Site admin

    Hi,

    Thanks for pointing this out. I've already committed the required fix and it will be deployed with 1.10.10 which I expect to be later this week.

    interesting point about the jQuery option - the description does say:

    Many pages will already have jQuery included, in which case you do not want to include it again.

    Any suggestions on how to reword it to make it clearer?

    Thanks,
    Allan

  • jtfairbankjtfairbank Posts: 4Questions: 1Answers: 0

    Totally, and once I re-read the description closely I figured out my mistake.

    Personally, I'd simplify it, either on the buttons themselves or on a line next to them:

    1. "I Load jQuery Elsewhere"
    2. "Include jQuery 2.x"
    3. "Include jQuery 1.x"

    To me, this needs to pass the skim test. Just listing No / 2.x / 1.x could go either way, with some people correctly thinking you'll include those files and others thinking click for what's already on your page.

    Maybe you can make it a two step button like with the Styles? Step one: tell us what you have. Step two: checkbox next to a statement "this will be included in the built file"?

  • allanallan Posts: 63,755Questions: 1Answers: 10,509 Site admin
    Answer ✓

    Makes sense - thanks! I'll make a change to the options.

    Allan

This discussion has been closed.