Ext.editor Edit control usage in EXTJS4

Source: Internet
Author: User

1. Edit plain text with a text box
The following is an edit control that works on a span label, and you can double-click the label to edit the label's text class capacity.

The code is as follows Copy Code

[HTML]
<div class= "Content" >
<span id= "Span1" > Please double-click me to modify text </span>
</div>

[Js]
Edit plain text with a text box
var editor1 = new Ext.editor ({
Shadow:false,
Completeonenter:true,//Auto finish when press ENTER
Cancelonesc:true,//press ESC to exit edit automatically
Updateel:true,//updated when changes are available
Ignorenochange:true,//ignoring the situation without change
Listeners: {
Complete:function (editor, value, OldValue) {
Ext.Msg.alert (' text changed ', "from" "+ OldValue +" "to" "+ Value +" "");
}
},
Field: {
Allowblank:false,
Xtype: ' TextField ',
width:150,
Selectonfocus:true
}
});

Ext.get ("Span1"). On (' DblClick ', function (event, span1_dom) {
Editor1.startedit (Span1_dom);
});

The effect picture is as follows

The effect is as follows:

When in edit state:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.