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

Editor Destroy not working

6 Answers 411 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 26 Nov 2012, 05:19 PM
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>
            <div>
                <textarea id="Textarea1" rows="10" cols="30" style="width:500px;height:300px">
                </textarea>
            </div>
        </div>

Window Open:

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

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

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

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

Thanks for the help.
Randy Miller

6 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 27 Nov 2012, 02:23 PM
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.

Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Joshua
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 18 Feb 2015, 07:12 PM
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.

http://jsfiddle.net/grippstick/56qkf7u7/
0
Dimo
Telerik team
answered on 20 Feb 2015, 12:49 PM
Hello Joshua,

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

http://docs.telerik.com/kendo-ui/api/javascript/kendo#methods-unbind

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

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ali
Top achievements
Rank 1
answered on 25 Feb 2021, 02:31 PM
you guys are ridiculous... customizing your elements is a nightmare and documentation sucks
0
Joshua
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 25 Feb 2021, 02:41 PM
@Ali Thanks for your insight.
0
Dimo
Telerik team
answered on 26 Feb 2021, 12:27 PM

Hi Ali,

I am saddened to see that you feel that way, especially when I take into account that you have been a loyal customer of us for years. I want to understand your point of view better, but I see only one support ticket in your account, and no recent communication with us by your colleagues.

Is it OK to contact you personally, so that you can share your feedback in more detail?

Regards,
Dimo
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Editor
Asked by
Randy
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Joshua
Top achievements
Rank 2
Iron
Veteran
Iron
Ali
Top achievements
Rank 1
Share this question
or