Editor Destroy not working

4 posts, 0 answers
  1. Randy
    Randy avatar
    72 posts
    Member since:
    Jan 2009

    Posted 26 Nov 2012 Link to this post

    I have a kendo window with an editor that I open and close with an editor on it. I want to destory the editor when I close the window. They command executes without error, but the editor stays in place and the next time I get a second editor. I was worried it was the window, but added a second editor on my main page and got the same results. Each time the window is open another editor appears, when I close and reopen it just stacks another one in.

    I am running: kendo.web.min.js v2012.3.1121

    HTML: (This is the test Text Area and is not in the window div.)
            <div style="padding-top: 5px;">
                <asp:Label ID="Label4" class="filterCheckboxHeader" runat="server" Text="Email Body Test:"></asp:Label>
                    <textarea id="Textarea1" rows="10" cols="30" style="width:500px;height:300px">

    Window Open:

    function labelEmail(trackingNumber) {
        var kendoWindow = $("#emailWindow").data("kendoWindow");
        // This is the real one, in the window div
            width: "300px",
            height: "150px"
        // This is the extra test one, not in the window div, they both behave the same.
            width: "300px",
            height: "150px"

    Window Close:
    function labelEmail_Cancel() {
    var kendoEditor = $("#txtLabelEmail_Body").data("kendoEditor");

    var Textarea1 = $("#Textarea1").data("kendoEditor");

    var kendoWindow = $("#emailWindow").data("kendoWindow");

    Thanks for the help.
    Randy Miller

  2. Dimo
    Dimo avatar
    8322 posts

    Posted 27 Nov 2012 Link to this post

    Hello Randy,

    The destroy method does not remove additional generated markup from the page, with the exception of popups and dropdowns. That's why you get multiple nested Editors.

    If initializing the Editor multiple times is really necessary, you will need to remove the old Editor from the DOM manually, append a new textarea and create a new Editor from it.

    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Joshua
    Joshua avatar
    66 posts
    Member since:
    May 2012

    Posted 18 Feb 2015 in reply to Dimo Link to this post

    With the latest version of Kendo, this process no longer functions. For some reason the defaultView property is not getting defined and an exception is being thrown when the value is changed. [Cannot use 'in' operator to search for 'getSelection' in undefined]

    I have created a fiddle to show the functionality.

  4. Dimo
    Dimo avatar
    8322 posts

    Posted 20 Feb 2015 Link to this post

    Hello Joshua,

    The Editor instance(s), which will be destroyed, must be unbound from the viewModel first.


    In your scenario you can use kendo.unbind() with $container (for all Editors at once) or with a specific Editor wrapper (table).

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top