Cannot read property off of 'null' when destroying a kendo-color-picker element

Thread is closed for posting
9 posts, 0 answers
  1. Isioma
    Isioma avatar
    2 posts
    Member since:
    May 2014

    Posted 01 May 2014 Link to this post

    I had been getting random errors when navigating through my app. After digging down into the issue if found the cause.

    When elements are removed from the down the scope must be destroyed. Angular Kendo listens to the $destroy event and responds by  removing any remaining event handlers as to minimize memory leaks.

    Starting at this this method:
    ```
    // Cleanup after ourselves
    scope.$on( '$destroy', 
       widget.destroy();
    });
    ```

    I only have the minified version of kendo.all.js, but the destroy method goes a little like

    ```
    destroy: function() {
    this.wrapper.off(y).find("*").off(y);
    this._popup && (this._selector.destroy(), this._popup.destroy());
    this._selector = this._popup = this.wrapper = null;
    h.fn.destroy.call(this)
    }
    ```


    The issue for me is the wrapper property is null by the time destroy is invoked. My guess is Angular and  JQuery removes this element before kendo has the chance to do so.





  2. Isioma
    Isioma avatar
    2 posts
    Member since:
    May 2014

    Posted 01 May 2014 in reply to Isioma Link to this post

    I understand that Angular-kendo is not formally supported, but as the issue is in kendo.all.min.js, I thought it would be relevant here as well.
  3. Kendo UI is VS 2017 Ready
  4. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 02 May 2014 Link to this post

    Hello Isioma,

    This is fixed in the latest versions of Kendo UI Core (where the color picker is available). The latest internal builds (available to customers with a subscription) also contain the fix.

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Roman
    Roman avatar
    2 posts
    Member since:
    Jul 2014

    Posted 21 Aug 2014 in reply to Alex Gyoshev Link to this post

    hi i purchased the telerik.kendoui.professional.2014.2.716.commercial and I am getting a bug like this. My purchase is recent as you can see but still i am getting this error, can you help me thanks :)
  6. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 22 Aug 2014 Link to this post

    Hello Roman,

    The 2014.2.716 is the offical Q2 version that does not contain the bug fix. To obtain it, use the latest internal build.

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  7. Robert
    Robert avatar
    6 posts
    Member since:
    Jul 2010

    Posted 09 Sep 2014 in reply to Alex Gyoshev Link to this post

    I'm using 2014.2.909 and I'm still seeing the same error:

    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 only see this error when moving away from a view that is using a grid with grouping or any sort of drag and drop enabled like column ordering.




  8. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 10 Sep 2014 Link to this post

    Hello Robert,

    From the error, it appears that the destroy method is being called on a destroyed widget. Using kendo.destroy instead of calling the widget's destroy method directly should remedy the problem. If it does not, provide a sample that shows the problem so that we may inspect it.

    Please note that this issue diverges from this thread, as it appears that it is related to the grid, and not the colorpicker. Please open separate threads for separate issues.

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  9. KrishnaMohan
    KrishnaMohan avatar
    1 posts
    Member since:
    Oct 2014

    Posted 06 Oct 2014 in reply to Alex Gyoshev Link to this post

    Hi Alex, I am doing a POC for my porject on Kendo UI & Angular JS with downloaded Demo version 2014.2.903 and getting problem with both Grid & Treemap.

    TypeError: Cannot read property 'wrapper' of undefined

    Any help would be greatly appreciated!
  10. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 07 Oct 2014 Link to this post

    Hello KrishnaMohan,

    Based on this information, it appears that the element instance is not retrieved. Please open a separate thread for this, attaching the POC so that we may take a look, or pasting the relevant code.

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready