jQWidgets Forums

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts

  • fbar
    Member

    Has anyone find a solution ?


    fbar
    Member

    I’ve experienced the same issue.
    The problem is that “jqxknockout.js” takes the “ko” dependency from window. While using requirejs knockout “ko” entry point is not exposed into the window object.

    A quick solution is to re-expose the knockout into the window object.

    File “jqx-ko-requirejs.js”:

    define(['knockout'], function (ko) {
    'use strict';
    var root = ( typeof window === 'object' && window ) || this;
    root.ko = ko;
    });

    Usage example:

    require.config({
    baseUrl : "libs",
    paths : {
    "jquery": ["//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery",
    "jquery-1.9.1"],
    "knockout": ["//ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1",
    "knockout-2.2.1"],
    "jqxwidgets": ["jqwidgets/jqx-all"],
    },
    shim: {
    "knockout": ["jquery"],
    "jqxwidgets": ["jquery", "knockout", "jqx-ko-requirejs"]
    }
    });
    require(['jquery', 'knockout'], function($, ko) {
    require(['jqx-ko-requirejs', 'jqxwidgets'], function() {
    //TODO...
    });
    });

    I hope the next release of jQWidgets will correct this issue and it will be more AMD “compilant”

    Regards,

    Francesc BAETA

Viewing 2 posts - 1 through 2 (of 2 total)