TypeError: Cannot read property 'destroy' of undefined

14 posts, 0 answers
  1. Rob
    Rob avatar
    6 posts
    Member since:
    Jul 2010

    Posted 10 Sep 2014 Link to this post

    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?
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 12 Sep 2014 Link to this post

    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!
     
  3. Rob
    Rob avatar
    6 posts
    Member since:
    Jul 2010

    Posted 15 Sep 2014 in reply to Petur Subev Link to this post

    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!
  4. Fabrizio
    Fabrizio avatar
    5 posts
    Member since:
    Jan 2016

    Posted 08 Mar 2016 Link to this post

    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

  5. Fabrizio
    Fabrizio avatar
    5 posts
    Member since:
    Jan 2016

    Posted 08 Mar 2016 in reply to Fabrizio Link to this post

    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 ...

  6. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 10 Mar 2016 Link to this post

    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!
     
  7. Fabrizio
    Fabrizio avatar
    5 posts
    Member since:
    Jan 2016

    Posted 18 Mar 2016 in reply to Nikolay Rusev Link to this post

    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}]}

  8. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 22 Mar 2016 Link to this post

    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!
     
  9. Fabrizio
    Fabrizio avatar
    5 posts
    Member since:
    Jan 2016

    Posted 22 Mar 2016 in reply to Nikolay Rusev Link to this post

    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

  10. Fabrizio
    Fabrizio avatar
    5 posts
    Member since:
    Jan 2016

    Posted 22 Mar 2016 in reply to Fabrizio Link to this post

    I think that you might need thes

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

  11. Kalli Kaldi
    Kalli Kaldi avatar
    30 posts
    Member since:
    Oct 2011

    Posted 23 Mar 2016 Link to this post

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

    Kalli Kaldi

  12. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 24 Mar 2016 Link to this post

    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!
     
  13. Kalli Kaldi
    Kalli Kaldi avatar
    30 posts
    Member since:
    Oct 2011

    Posted 29 Mar 2016 Link to this post

    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

  14. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 31 Mar 2016 Link to this post

    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!
     
Back to Top