Hi. I’m trying to use kendoEditor inside a View in a SPA.
When this View is shown for the first time the kendoEditors are built in its init(), and they render perfectly. Then, if I exit the view and try to load it again, this error appears in the console:
Uncaught TypeError: Cannot use 'in' operator to search for 'getSelection' in undefined kendo.web.min.js?version=1:35
I tried to do a refresh() of the editor in the show() of the view, but it doesn’t even get to enter it.
That’s in chrome.
In IE/Edge it breaks when loading the View for the first time: it renders (and the kendoEditors inside it), but the view that was previously loaded in that container is still there, below the new.
is there any solution?
Thanks
6 Answers, 1 is accepted
Hello Juan Jose,
I tried to reproduce the problem in the following Dojo snippet, to no avail. Can you please adjust it so that it shows the problem?
Regards,Alex Gyoshev
Telerik
Hello,
I did a little, very simple mockup of my app here:
http://dojo.telerik.com/uKuVI/3
Click edit button, make changes in any textarea, cancel, try to enter edit form again, this error displays in console:
Uncaught TypeError: Cannot use 'in' operator to search for 'getSelection' in undefined
Thanks.
Hello Juan Jose,
Since the editor widget is being moved in the DOM, it requires a call to its refresh method. You can call it on all editor widgets within the .main container with the following line:
$(".main").find(kendo.roleSelector("editor")).kendoEditor("refresh");
Here is the updated Dojo snippet.
Regards,Alex Gyoshev
Telerik
Hello,
That doesn't completely solve the problem.
In your Dojo snippet, try this: make changes in both editors, then click cancel, and click again edit. The
Uncaught TypeError: Cannot use 'in' operator to search for 'getSelection' in undefined
errors keep appearing in the console and the edit view doesnt show. If you keep clicking Edit, it finally appears... but thats not usable.
Thanks again.
thanks for the reproduction steps. Indeed, this seems so. We will need to investigate the causes further; Due to the holidays, our team is currently very short on staff, so please expect an additional response from us next week. I am sorry for the delay.
Regards,
Petyo
Telerik
Hello Juan Jose,
The issue is caused by the load_data method, which attempts to set the editor value while the iframe is in a broken state. If set after the editor content is refreshed, the problem disappears. We will investigate whether this can be handled by our code, but at this time you can resolve the problem by updating the editor value after the refresh call. Here is the updated Dojo snippet.
Regards,Alex Gyoshev
Telerik