RequireJS aspnetmvc missing dependencies

2 posts, 0 answers
  1. Vasile
    Vasile avatar
    33 posts
    Member since:
    Dec 2010

    Posted 18 Apr 2013 Link to this post

    Hello,
    I am using Kendo UI Web with RequireJS in an ASP.MVC 4 application. Recently I reached the folowing situation:
    In a form I am using MultiSelect control and I try to load required kendo components with requirejs using the following pseudocode:
    <script>
    require(['other_modulea','kendo-multiselect','kendo-aspnetmvc'], function(){
         // execute deffered controls initialization scripts.
    });
    </script>

    But there is no dependency established between kendo-aspnetmvc and kendo-multiselect (and kendo-combobox - seems to have similar issues). It happens that aspnetmvc executes before kendo-multiselect fulfills it's dependencies, this results in aspmvc not being able to attach to ComboBox and MultiSelect the requestData function. This function is called on deffered initialization script and because aspnetmvc script was loaded prior to kendo-multiselect the function is not available.
    It seems that despite the order of modules in requirejs the execution order of the modules is not guaranteed as long as there are no dependencies between them.

    Do you have any ideea how this could be solved?

    One way could be:
    <script>
    require(['other_modulea','kendo-multiselect'], function(){
        require(['kendo-aspnetmvc'], function(){
             // execute deffered controls initialization scripts.
         });
    });
    </script>
    but I would really preffer a more generic approach instead on doing this nested require all over the application.

    Thanks,
    Vasile
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 22 Apr 2013 Link to this post

    Hello Vasile,

     
    Currently, the kendo.aspnetmvc.js depends on kendo.data.js only. We will change this in the next internal build due the mid of this week. Check it and let me know if the problem still persists.
    I updated your Telerik points, because of the finding.

    All the best,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top