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

TypeError: Cannot read property 'destroy' of undefined

13 Answers 2001 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 10 Sep 2014, 04:08 PM
I'm using the 2014.2.909 nightly build and Angular-Kendo 1.03.  When I create a grid that has filtering, grouping, or column ordering, I get this when navigating away from the view:

TypeError: Cannot read property 'destroy' of undefined
at N.ui.DataBoundWidget.extend.destroy (http://localhost:1391/Scripts/kendo/2014.2.909/kendo.all.min.js:22:31285)
at http://localhost:1391/Scripts/angular-kendo.js:214:28
at Scope.$broadcast (http://localhost:1391/Scripts/angular.js:12887:28)
at Scope.$destroy (http://localhost:1391/Scripts/angular.js:12545:14)
at Scope.$delegate.__proto__.$destroy (<anonymous>:812:29)
at cleanupLastView (http://localhost:1391/Scripts/AngularUI/ui-router.js:2243:26)
at updateView (http://localhost:1391/Scripts/AngularUI/ui-router.js:2269:11)
at eventHook (http://localhost:1391/Scripts/AngularUI/ui-router.js:2224:17)
at Scope.$broadcast (http://localhost:1391/Scripts/angular.js:12887:28)
at $state.transition.resolved.then.$state.transition (http://localhost:1391/Scripts/AngularUI/ui-router.js:1822:22)
Detected Kendo UI version: "2014.2.909" 

I am not explicitly calling destroy, it is being handled by Angular or jQuery (I suspect the former since the grid is created via a Angular-Kendo directive).  I have a page with many grids like this in various tabs and when leaving the page, I end up flooding my error logging with this same error for each behavior on each grid that causes it.  I had suspected it was an issue with Angular-Kendo but the issue in that repo has been closed for a long time.  I read in this thread what seemed like a similar problem since all of the widgets decend from the same base but switching to the nightly build didn't change anything.  It does look like the widget is being destroyed by something, how do I get Kendo to stop trying to do it again?

13 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 12 Sep 2014, 03:19 PM
Hello Robert,

I am not sure what exactly is going wrong , could you please share a small isolated example which we can run on our side and investigate on? If the issue really exists with standard setup I will forward it to the Dev team so they can fix it.

Thank you for the understanding and cooperation.

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Rob
Top achievements
Rank 1
answered on 15 Sep 2014, 10:11 PM
Hi Petur,

I ended up solving it.  I was still referencing a build of angular-kendo from Nuget instead of the one that ships with KendoUI and more importantly, the one included with this nightly build.  Soon as I switched over to that version the problem disappeared.

Thanks!
0
Fabrizio
Top achievements
Rank 1
answered on 08 Mar 2016, 09:03 AM

We also have this problem, 

TypeError: Cannot read property 'destroy' of undefined
    at ue.ui.DataBoundWidget.extend.destroy (kendo.all.min.js:47)
    at kendo.all.min.js:86
    at Scope.$broadcast (angular.js:16573)
    at Scope.$destroy (angular.js:16192)
    at cleanOld (angular-ui-router.js:3978)
    at angular-ui-router.js:3984
    at Object.statics.leave (angular-ui-router.js:3898)
    at Object.leave (angular-ui-router.js:3923)
    at cleanupLastView (angular-ui-router.js:3983)
    at angular-ui-router.js:4031

It happens only on pages that have Kendo-Grid.

Wouldn't it be great if it is just checked that the property exists on that object before method call.

Thanks

0
Fabrizio
Top achievements
Rank 1
answered on 08 Mar 2016, 09:17 AM

I will be talking about the latest 2016.1.226+SP1 version

File: src/kendo.grid.js
var Grid = kendo.ui.DataBoundWidget.extend({
....

before:
1834:        if (that.options.reorderable) {
1835:            that.wrapper.data('kendoReorderable').destroy();
1836:        }

after:
1834:        if (that.options.reorderable) {
1835:            try { that.wrapper.data('kendoReorderable').destroy(); } catch (e) { }
1836:        }

It seams that many other widget work this way, so ...

0
Nikolay Rusev
Telerik team
answered on 10 Mar 2016, 09:26 AM

Hello Fabrizio,

 

We are not sure how to replicate the error in question. Could you provide us with a isolated runnable example or a dojo where the error can be observed?

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Fabrizio
Top achievements
Rank 1
answered on 18 Mar 2016, 10:24 AM

Hello,

I guess that this might help

var initialDataGrid = {
            resizable: true,
            reorderable: true, // throws error
            groupable: true, // throws error
            autoBind: true,
            filterable: {
                mode: "menu", // "menu, row"
                extra: false,
            },
            sortable: {
                mode: 'multiple'
            },
            pageable: {
                refresh: true,
                buttonCount: 5,
                pageSizes: [10, 20, 50, 100]
            },
            editable: {
                destroy: false,
                update: false,
                confirmation: true
            },
            columnMenu: true
        };

 

When I disable
reorderable: true, // throws error
groupable: true, // throws error

these two parameters there are no error throwings.

Please give it a go with this JSON:
{"resizable":true,"reorderable":true,"groupable":true,"autoBind":true,"language":"en-US","filterable":{"mode":"menu","extra":false},"sortable":{"mode":"multiple"},"pageable":{"refresh":true,"buttonCount":5,"pageSizes":[10,20,50,100]},"editable":{"destroy":false,"update":false,"confirmation":true},"columnMenu":true,"columns":[{"name":"title","field":"title","title":"{{'ALBUM_COLUMN_TITLE' | translate}}","lockable":false,"width":400},{"name":"artist","field":"artist","title":"{{'ALBUM_COLUMN_ARTIST' | translate}}","lockable":true,"width":200},{"name":"author","field":"author","title":"{{'ALBUM_COLUMN_AUTHOR' | translate}}","lockable":true,"width":200},{"name":"commands","command":[{"name":"change","enabled":true,"text":"{{ 'GRID_BUTTON_EDIT' | translate}}","mode":"route","route":{"identifier":null,"state":null,"params":{}}},{"name":"remove","enabled":true,"text":"{{ 'GRID_BUTTON_DELETE' | translate}}","mode":"dialog","dialog":{"type":"confirm","title":"Delete","content":"Delete this resource?","template":"Delete this resource?"}}],"width":250}]}

0
Nikolay Rusev
Telerik team
answered on 22 Mar 2016, 08:36 AM

Hello Fabrizio,

 

We are still not able to replicate the error. Here is an example assembled based on your code snippet: http://dojo.telerik.com/@rusev/oCuni

 

All seems to be working properly. Please modify it so that the error appears in it in order to 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!
 
0
Fabrizio
Top achievements
Rank 1
answered on 22 Mar 2016, 11:52 AM

Hello Nikolay Rusev,

I have managed to reproduce the bug.

Thank you very much for your time and effort to establish the DOJO sample for this.

You can now check it out.

BR,

Nikola Ivanović
nikola.ivanovic@horisen.com

0
Fabrizio
Top achievements
Rank 1
answered on 22 Mar 2016, 11:52 AM

I think that you might need thes

http://dojo.telerik.com/OLAkE/2

0
Kalli Kaldi
Top achievements
Rank 1
answered on 23 Mar 2016, 11:46 AM

I'm really looking forward to the response to this issue ....

Kalli Kaldi

0
Nikolay Rusev
Telerik team
answered on 24 Mar 2016, 09:05 AM

Hello Kalli &  Nikola,

 

The issue seems to already been fixed in the latest internal builds

 

I've upgraded the Kendo UI scripts and all seems to be working properly.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Kalli Kaldi
Top achievements
Rank 1
answered on 29 Mar 2016, 08:38 AM

Hello Nikolay and thanks for you replay.

Now, I cannot use this version in the Custom Download tool because it will not be available until the release of Q2.  And that will be when ?

 

Best regards,
Kalli

0
Nikolay Rusev
Telerik team
answered on 31 Mar 2016, 06:47 AM

Hello Kalli,

 

Indeed the `Download Builder` is updated on major releases. That said the Q2 2016 release is scheduled for the first half of May.

 

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
Grid
Asked by
Rob
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Rob
Top achievements
Rank 1
Fabrizio
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Kalli Kaldi
Top achievements
Rank 1
Share this question
or