Editor in an SPA's View isn't working

7 posts, 0 answers
  1. Juan Jose
    Juan Jose avatar
    45 posts
    Member since:
    Jul 2013

    Posted 17 Dec 2015 Link to this post

    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

  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 21 Dec 2015 Link to this post

    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
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Juan Jose
    Juan Jose avatar
    45 posts
    Member since:
    Jul 2013

    Posted 22 Dec 2015 in reply to Alex Gyoshev Link to this post

    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.

  5. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 24 Dec 2015 Link to this post

    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
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Juan Jose
    Juan Jose avatar
    45 posts
    Member since:
    Jul 2013

    Posted 28 Dec 2015 in reply to Alex Gyoshev Link to this post

    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.

     

  7. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 30 Dec 2015 Link to this post

    Hello,

    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
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 06 Jan Link to this post

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