Kendo UI & RequireJS: x is not a function, although Kendo is loaded

3 posts, 0 answers
  1. Stefan
    Stefan avatar
    3 posts
    Member since:
    Nov 2015

    Posted 06 Jun Link to this post

    Hello,

     

    I use RequireJS to load Kendo according to a post in StackOverflow (http://stackoverflow.com/questions/18671338/inject-kendo-ui-with-requirejs) and it works. jQuery is loaded first, then Kendo. But I got an error "kendoButton is not a function" (applies to all Kendo UI components, but here I use kendoButton as an example). Here is my app.js.

    require.config({
        paths: {
            "jquery": "lib/kendo-ui/jquery.min",
            "jquery-ui": "lib/jquery-ui.min",
            "kendo-ui": "lib/kendo-ui" // this is a directory containing all Kendo files
        },
        shim: {
            "kendo-ui/kendo.button.min": {
                deps: ["jquery"]
            },
            "kendo-ui/kendo.core.min": {
                deps: ["jquery"]
            }
        }
    });

    require(["jquery", "kendo-ui/kendo.core.min", "kendo-ui/kendo.button.min"],
    function ($)
    {
        $("#primaryTextButton").kendoButton();
    });

    Kendo troubleshooting says that jQuery should be included just once (yes, I have) and all the required Kendo files are included (yes, I included kendo.core.min.js).

    I use RequireJS 2.2.0, Kendo 2016.1.226, and jQuery version, which is included in the Kendo package. Can someone point out what's wrong?

    Thanks and regards,

    Stefan

  2. Stefan
    Stefan avatar
    3 posts
    Member since:
    Nov 2015

    Posted 06 Jun in reply to Stefan Link to this post

    I just read a post by Peter and found the solution: Set the baseURL to "js/kendo".
    I'm not sure if this has been stated clearly in the documentation. I thought the URL in the example is well, an example, but it turns out to be important.
  3. Kendo UI is VS 2017 Ready
  4. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 08 Jun Link to this post

    Hello,

    the baseUrl is important, indeed. Worth mentioning is that if you start a project now, you may give the NPM packages a try. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top