This is a migrated thread and some comments may be shown as answers.

INTERNAL ERROR

9 Answers 216 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Fernando
Top achievements
Rank 1
Fernando asked on 15 Oct 2015, 02:00 PM

Good morning , we upgrade to version 2015.2.827 , and several components have stopped working . Apparently this giving an internal error that could not figure out

 

The error occurs in the function below.

File Name:  kendo.web.js

/// ====================================================================

 function calculateAggregate(accumulator, aggregates, item, index, length, state) {
        aggregates = aggregates || [];
        var idx,
            aggr,
            functionName,
            len = aggregates.length;

        for (idx = 0; idx < len; idx++) {
            aggr = aggregates[idx];
            functionName = aggr.aggregate;
            var field = aggr.field;
            accumulator[field] = accumulator[field] || {};
            state[field] = state[field] || {};
            state[field][functionName] = state[field][functionName] || {};
            accumulator[field][functionName] = functions[functionName.toLowerCase()](accumulator[field][functionName], item, kendo.accessor(field), index, length, state[field][functionName]);
        }
    }​

 ==============================================================================================

Error: Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

 

 

 

 

9 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 19 Oct 2015, 03:59 PM
Hello Fernando,

This does not sound like a known issue. Is it possible for you to isolate the case in a separate project with mock data so I can examine it and assist you further?

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Fernando
Top achievements
Rank 1
answered on 19 Oct 2015, 05:58 PM

Hi Alexander.

I have created a demo example of my problem with a code closer than mine here: http://dojo.telerik.com/idoVo 

It works, so the issue is in my code. The widget(kendoTreeView) is created with the parameters as shown in the "img3.png" attachment. Its dataSource(HierarchicalDataSource) uses a custom read method, as shown in the "img1.png" attachment. The data used in the demo is my real data. The content of this url(https://api.myjson.com/bins/1axc8) is the same in the attachment "img1.png" screenshot. It is the same data passed to options.success(data). The problem is that inside it - check the "img2.png" attachment - it throws an error with something related to "aggregate" data, and I don't know what may causing this. No dataSource have any aggregate function defined.

0
Alexander Valchev
Telerik team
answered on 21 Oct 2015, 10:39 AM
Hello Fernando,

Thank you for the example and for the detailed information.

I am not aware of any known issue that might be the reason of the error that you receive. Is the Kendo UI version in your project the same as the one used in the working Dojo test page? If it's not please try upgrading and see if the issue still persists. If it is the same, I will need a runnable sample project with mock data that demonstrates the issue. In this way I will be able to debug the Kendo UI Source and find out what causes the error.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Fernando
Top achievements
Rank 1
answered on 21 Oct 2015, 12:28 PM

Hello Alexander.

I'm trying to reproduce the problem in a demo, but even with the same code I can't. It always works. The only thing that comes to my mind is that it can be a global setting or something in my application which doesn't affects the demos I created outside it. So I debugged to see what happens in the demo code, in specific the kendo.web.js file to campare with the buggy one.

I realize that inside the _process method of the buggy environment, the that._aggregate property is filled with code that isn't ours, while in the demo code the property is undefined. Printing the function in the console - in the moment that a breakpoint is inside the _proccess function -, I have the output of the screenshot in the img4.png attached file.

I'm attaching the demo I've made(kendo bug.zip), which works, but is the closest I can get of my buggy environment. Note that the version of the kendo.web file in the demo is 2015.2.827 but the problem also occurs in the newer version.

I wonder what creates that aggregate function that causes the bug, that is what crashing my app. The libraries that wraps the kendo widget in the demo are the same in the buggy app and it generates the same dataSource too, no different options are set.

Thank you in advance.

0
Alexander Valchev
Telerik team
answered on 23 Oct 2015, 10:32 AM
Hi Fernando,

The only thing that I can suggest is to start removing parts of the code in the buggy environment until you find out which part causes the error. Check if something does not change the Kendo UI widget prototypes or if something does not change the configuration objects.

If there are any 3rd party libraries in the buggy environment you should isolate and remove them during the debug process.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Fernando
Top achievements
Rank 1
answered on 23 Oct 2015, 05:25 PM

The errors still occurs when I run this code:

 

        $("#layers").kendoTreeView(
        {
            dataSource: new kendo.data.HierarchicalDataSource(
            {
                transport: 
                {
                    read: 
                    {
                        url: "@this.TreeViewUrl("Layer/GetProductionUnits")"
                    }
                },
                dataTextField: "Text",
                schema: 
                {
                    model: 
                    {
                        id: "Value",
                        hasChildren: "HasChildren"
                    }
                }
            })
        });

 

As you can see, it is only and pure kendo code. What I'm trying to say is that my app may have something *outside*, global, I don't know, which is causing this. I'm trying to figure out what it can be. What can add an *aggregate* method in the widget even if I don't set anything like that. I'm afraid I will have to open a ticket for this issue.

0
Fernando
Top achievements
Rank 1
answered on 23 Oct 2015, 05:36 PM

I believe I have fixed it, but I had to get rid of the HierarchicalDataSource. I changed to a simpe dataSource object. I don't know why it stop working since it is a 2+ year old code used all around the application.

 

This issue came along with an issue in the DropDownList, in which when user chooses an option, the selected value becomes [object Object]. This is an another old code used in all application that sudenly stop working too. Sometimes we are afraid to update the kendo version.

0
Fernando
Top achievements
Rank 1
answered on 23 Oct 2015, 05:50 PM

I have attached an example of how the DropDownList behaves now.

These are the parameters we use to initialize it:

{
        dataValueField: "Value",
        dataTextField: "Text",
        optionLabel: { Value: "", Text: "" },
        template: kendo.template("#if (data && data.Text) {#${data.Text}#}#&nbsp;"),
        dataSource: {
            type: "json",
            serverFiltering: true,
            transport: {
                read: {
                    dataType: "json",
                    url: dropDownUrl,
                    type: "POST",
                    contentType: "application/json; charset=utf-8"
                },
                parameterMap: function (options) {
                    return JSON.stringify(options);
                }
            },
            schema: {
                data: function (data) {  
                    if ($.isArray(data)) return data;
                    else return [data];
                }
            },
            error: function (e) {
                handleRequestError(e.xhr.status);
            }
            ,
            requestStart: function (e) {
                thisEl.data("kendoDropDownList").select(0);
            }
        }
    };​

 

And this the data applied to the image example I've posted:

[{"Value":1,"Text":"Administrativo","Code":null,"LogData":null,"Parameters":null}]

 Any idea on this issue?

0
Nikolay Rusev
Telerik team
answered on 28 Oct 2015, 07:54 AM

Hello Fernando,

 

I've used the code snippet as a strarting point to replicate the described behavior and only mocked the jQuery.ajax call. Unfortunately I wasn't able to replicate it.

 

Here is the example - http://dojo.telerik.com/@rusev/oHEYe. Could you please modify it so that it replicates the issue? Thus we'll be able to debug it locally and assist you further.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
Fernando
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Fernando
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or