inline editor, the change event not firing

6 posts, 1 answers
  1. ivan
    ivan avatar
    27 posts
    Member since:
    Aug 2013

    Posted 07 Jan 2014 Link to this post

    Hi, 

    I have a div based inline editor,  it could run, but the change event will not fire.
    the div:

    var textareastr="<div contentEditable id=\'ctle\'></div>";
    jQuery("#test").append(textareastr);

    the kendoeditor:<br>jQuery("#ctle").kendoEditor();
     var editor = jQuery("#ctle").data("kendoEditor");
    editor.bind("change",function(event) {
                var script=this.value();
                alert("b:"+script);
                });

    You can test above code.

    The inline editor do need the change event. because this is the time we can post the data to the server.

    yours,
    Ivan

  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 07 Jan 2014 Link to this post

    Hello Ivan,

    I tried to reproduce the issue here, but everything seems to be working as expected. Could you please take a look at the example and let me know if I am doing something differently?

    Regards,
    Alexander Popov
    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. Answer
    ivan
    ivan avatar
    27 posts
    Member since:
    Aug 2013

    Posted 07 Jan 2014 Link to this post

    Hello Alexander,
    Thank you for your feed back!

    I found the reason:
     jQuery("#test").bind("blur",{msgp: sendp} ,function(event) { 
    //something
    });

    I bind a blur event to the "#test" element after the kendoUI creation.
    I remove it, the problem is gone.

    Why the event on the source element will affect the kendoUI editor?
    Yours,
    Ivan

  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 08 Jan 2014 Link to this post

    Hello again Ivan,

    Basically attaching a blur event handler to a div element shouldn't affect the Editor in any way, so I am not sure what exactly caused the issue in your case. Under normal circumstances div elements should even trigger the blur event, as you can see in this updated example.

    Regards,
    Alexander Popov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. ivan
    ivan avatar
    27 posts
    Member since:
    Aug 2013

    Posted 08 Jan 2014 Link to this post

    Hello your self Alexander,
    any way, it makes the problem gone.
    I can repeat the problem when I bind the blur event to the div. the div is generated and the blur event is binded later(after the kendoeditor's creation.

    yours,
    ivan

  7. Charlie
    Charlie avatar
    5 posts
    Member since:
    Mar 2015

    Posted 16 Apr 2015 in reply to ivan Link to this post

    Actually I ended up using this

    $("[data-role=editor]").on('blur', function (event) {
       me.onEditorChange(event)
    })

    For attaching a blur handler to the editor, now I can tell when the editor loses focus regardless of wether the contents change or not.
Back to Top
Kendo UI is VS 2017 Ready