"n is not a constructor"

3 posts, 1 answers
  1. Howard
    Howard avatar
    2 posts
    Member since:
    Nov 2015

    Posted 07 Mar Link to this post

    I am using version 2019.1.220 with Kendo UI for ASP.NET MVC, having upgraded recently from 2016.1.112, and I am now getting a Javascript error: "n is not a constructor". My chart is fairly simple:

    @(Html.Kendo().Chart(Model.Errors)
        .Name("AppErrorsChart")
        .Title("Error BreakDown By % Frequency?")
        .Legend(legend => legend
            .Position(ChartLegendPosition.Top)
        )
        .Series(series =>
        {
            series.Pie<int>(model => model.Count, model => model.Type)
            .Labels(labels => labels
                .Visible(true)
                .Template("#= category # - #= kendo.format('{0:P}', percentage)#")
            );
        })
        .Tooltip(tooltip => tooltip.Visible(true).Template("#= dataItem.Error# (#= value#)").Color("#FFF"))
        .Events(e => e.SeriesClick("onCategorySeriesClick").AxisLabelClick("onCategorySeriesClick")
        )
    )

     

    Here is a Dojo that I created that demonstrates this: https://dojo.telerik.com/OBUzIVif

     

    The error is in kendo.web.js, as shown in the attached screenshot.

     

    Please advise on a course of action. Thank you.

  2. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 11 Mar Link to this post

    Hello Howard,

    The problem is specifically in having a reference to kendo.web.min.js. When there is a kendo.all.min.js reference, all Kendo UI widgets are already included in the page and you should not reference subsets of the Kendo UI library (web, dataviz, etc.).

    In this scenario, when kendo.web.min.js is referenced after kendo.all.min.js, it overwrites the plugins registered by the "all" file and widgets that are not part of the "web" subset, including the Chart, cannot be loaded. You can see in the Dojo that if you remove the "web" reference, the Chart loads successfully.

    Regards,
    Tsvetina
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Howard
    Howard avatar
    2 posts
    Member since:
    Nov 2015

    Posted 11 Mar in reply to Tsvetina Link to this post

    Great, thank you so much. We had the references to both when using the 2016 version and it did not cause any problems, so there was no reason for us to think any different this time.
Back to Top