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

inline editor, the change event not firing

5 Answers 377 Views
Editor
This is a migrated thread and some comments may be shown as answers.
ivan
Top achievements
Rank 1
ivan asked on 07 Jan 2014, 02:45 PM
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

5 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 07 Jan 2014, 03:54 PM
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!
0
Accepted
ivan
Top achievements
Rank 1
answered on 07 Jan 2014, 04:19 PM
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

0
Alexander Popov
Telerik team
answered on 08 Jan 2014, 09:48 AM
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!
0
ivan
Top achievements
Rank 1
answered on 08 Jan 2014, 10:54 AM
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

0
Charlie
Top achievements
Rank 1
answered on 16 Apr 2015, 03:52 PM
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.
Tags
Editor
Asked by
ivan
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
ivan
Top achievements
Rank 1
Charlie
Top achievements
Rank 1
Share this question
or