Introduce kendo ui with requirejs

The documentation for kendo ui and requirejs seems to be missing some things.

They will tell me how to use kendo.web.min, which has everything:

http://www.kendoui.com/blogs/teamblog/posts/13-05-08/requirejs-fundamentals.aspx

(search for the keyword 'shim')

but I'm not interested in adding a large 2MB kendo.web.min script, I just want to fake

kendo.grid.min, but this file has a dependency on kendo.data.min, which again has a dependency

to kendo.core.min.

How can I tell requirejs to download also kendo.data.min and kendo.core.min before downloading kendo.grid.min and after loading jquery. I just think it will be the right order.

This is what I tried from the above telerik link:

requirejs.config({
    paths: {
        'text': '../Scripts/text',
        'durandal': '../Scripts/durandal',
        'plugins': '../Scripts/durandal/plugins',
        'transitions': '../Scripts/durandal/transitions',
        'knockout': '../Scripts/knockout-2.3.0',
        'jquery': '../Scripts/jquery-2.0.3',     
        'kendoGrid': '../Scripts//kendo.grid.min',
    },
    shim: {
        "kendoGrid": {
            deps: ["jquery"]
        }
    }
});

, kendo.data kendo.core?

durandal . js :

" (viewmodels/DocumentBrowser). details: \jQuery\ undefined " ".

, kendo, kendo ui requirejs DocumentBrowser, !

UPDATE

CodingWhitSpike requirejs:

requirejs.config({
    paths: {
        'text': '../Scripts/text',
        'durandal': '../Scripts/durandal',
        'plugins': '../Scripts/durandal/plugins',
        'transitions': '../Scripts/durandal/transitions',
        'knockout': '../Scripts/knockout-2.3.0',
        'jquery': '../Scripts/jquery-2.0.3',
        'moment': '../Scripts/moment',
         k: "../Scripts/kendo"
    }
});

define(['durandal/app', 'plugins/dialog', 'knockout', 'services/dataservice', 'plugins/router', 'moment', 'k/kendo.grid.min'],
    function (app, dialog, ko, dataservice, router, moment, kendoGrid) {

 $("#grid").kendoGrid(...); => kendoGrid is instantiated and it works :)

});
+2
1

Kendo http://docs.kendoui.com/getting-started/using-kendo-with/using-kendo-with-requirejs

<!-- first, load RequireJS -->
<script src="require.js"></script>

<!-- configure RequireJS with two logical paths:
     - "app/" will be used for your files
     - "k/" will be for Kendo UI modules -->

<script>
  requirejs.config({
      paths: {
          app: "/path/to/your/files",
          k: "http://cdn.kendostatic.com/VERSION/js"
      }
  });

  require([
      "http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js",
      "app/foo",
      "app/bar",
      "k/kendo.menu.min",
      "k/kendo.grid.min"
  ], initApp);

  function initApp() {
     // main entry point of your application
  }
</script>

, , , k: "http://cdn.kendostatic.com/VERSION/js, ( ), k/kendo.grid.min , .

+3

Source: https://habr.com/ru/post/1530624/


All Articles