This is a migrated thread and some comments may be shown as answers.
Insert(Ordered)List not working in template
2 Answers 24 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Peter
Top achievements
Rank 1
Peter asked on 28 Dec 2011, 11:42 AM
hi,

I've wrapped up the editor in a template.
Looks like this

@using Telerik.Web.Mvc.UI
@model string
@{
    var documentName = ViewData.TemplateInfo.HtmlFieldPrefix;
    var hideShowFunction = "HideShow" + documentName;
    string documentContent = HttpUtility.HtmlDecode(ViewData.TemplateInfo.FormattedModelValue.ToString());
 
}
 
<script type="text/javascript">
function @(hideShowFunction)() {
        var editor = $("#@documentName").data("tEditor");
        $(editor.window).bind("focus", function () {
            $("#@documentName .t-editor-toolbar").show();
        }).bind("blur", function () {
            $("#@documentName .t-editor-toolbar").hide();
        });
      $("#@documentName .t-editor-toolbar").hide();
}
</script>
 
 
@(
 Html.Telerik().Editor()
        .Name(documentName)
        .ClientEvents(events => events.OnLoad(hideShowFunction))
        .Tools(tools =>
                    {
                        tools.Clear();
                        tools.Bold();
                        tools.Italic();
                        tools.Underline();
                        tools.Strikethrough();
                        tools.InsertOrderedList();
                        tools.InsertUnorderedList();
                        tools.InsertImage();
                    })
        .Value(documentContent)
        .HtmlAttributes(new { style = "height:120px" }))

This way I can have several simple editor's on the same page, only the active one displaying a simple toolbar.

My problem are the ordered-list tools. Being clicked they result in a general Telerik error:  "Unable to get value of the property 'parentNode': object is null or undefined"

I have already tried striking the custom toolbar and striking the client event. The error remains. So I guess it has to do with the fact I'm using the editor in a template. 

What am I missing ?

kind regards,

Peter 





 

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 29 Dec 2011, 02:07 PM
Hi Peter,

Thank you for bringing this to our attention. The error was raised when one of the ordered-list tools is used on a Editor which doesn't contain any text.
I attached a hotfix build which should resolve this problem. I also added 300 Telerik points to your account.

All the best,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Peter
Top achievements
Rank 1
answered on 17 Jan 2012, 08:29 AM
hi,

it has even been fixed in your latest real ease. Faster than my response in this thread :)
Great !

Peter
Tags
Editor
Asked by
Peter
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Peter
Top achievements
Rank 1
Share this question
or