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

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

8 Answers 1520 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Isioma
Top achievements
Rank 1
Isioma asked on 01 May 2014, 09:24 PM
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.





8 Answers, 1 is accepted

Sort by
0
Isioma
Top achievements
Rank 1
answered on 01 May 2014, 09:25 PM
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.
0
Alex Gyoshev
Telerik team
answered on 02 May 2014, 08:20 AM
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!
 
0
Roman
Top achievements
Rank 1
answered on 22 Aug 2014, 12:09 AM
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 :)
0
Alex Gyoshev
Telerik team
answered on 22 Aug 2014, 07:34 AM
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!
 
0
Rob
Top achievements
Rank 1
answered on 09 Sep 2014, 08:21 PM
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.




0
Alex Gyoshev
Telerik team
answered on 10 Sep 2014, 09:39 AM
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!
 
0
KrishnaMohan
Top achievements
Rank 1
answered on 06 Oct 2014, 02:56 PM
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!
0
Alex Gyoshev
Telerik team
answered on 07 Oct 2014, 07:24 AM
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!
 
Tags
ColorPicker
Asked by
Isioma
Top achievements
Rank 1
Answers by
Isioma
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Roman
Top achievements
Rank 1
Rob
Top achievements
Rank 1
KrishnaMohan
Top achievements
Rank 1
Share this question
or