我想添加标签,显示我在文本区域中写入的字符长度。那么,我如何在EXT.Message.Box中添加标签 这是代码......
function UnLockRemarkWindow(a) {
var c = Ext.MessageBox.show({
title: "Version Remarks",
inputType: "textarea",
msg: "Please Enter Version Remarks:",
width: 375,
buttons: Ext.MessageBox.OKCANCEL,
multiline: true,
fn: b,
icon: Ext.MessageBox.INFO,
modal: true,
closable: false,
allowBlank: false
});
c.textField.inputEl.dom.type = "textarea";
答案 0 :(得分:3)
您需要在消息框的textareafield
配置中指定label
和items
才能实现此目的,即您需要将textarea和label标识为消息框的子项。
一个工作示例:
Ext.application({
launch : function() {
var c = Ext.Msg.show({
title: "Version Remarks",
items:[
{
xtype:'textareafield',
labelWrap:true,
label: "Please Enter Version Remarks:",
},
{
xtype:'label',
html:'0 of 500',
height:20,
style:{
textAlign:'right',
background:'white'
}
},
],
width: 375,
buttons: Ext.MessageBox.OKCANCEL,
multiline: true,
icon: Ext.MessageBox.INFO,
modal: true,
closable: false,
allowBlank: false
});
}
});

<link rel="stylesheet" href="https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css">
<script type="text/javascript" src="https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all-debug.js"></script>
&#13;
MessageBox
无法实现。我们需要使用Ext.window
来实现这一目标。在textareafield
窗口配置中指定label
和items
。
一个工作示例:
Ext.application({
name : 'Fiddle',
launch : function() {
Ext.create('Ext.window.Window', {
title: "Version Remarks",
items:[
{
xtype:'textareafield',
width:'100%',
fieldLabel: "Please Enter Version Remarks:",
},
{
xtype:'label',
text:'0 of 500',
height:20,
width:'100%',
style:{
textAlign:'right',
display:'block'
}
},
],
width: 375,
buttonAlign : 'center',
buttons:[ {
text:'OK'
},
{
text:'Cancel'
}],
modal: true,
closable: false,
}).show();
}
});
&#13;
<link rel="stylesheet" href="https://cdn.sencha.com/ext/gpl/4.1.1/resources/css/ext-all.css">
<script type="text/javascript" src="https://cdn.sencha.com/ext/gpl/4.1.1/ext-all-debug.js"></script>
&#13;
答案 1 :(得分:0)