![](/img/trans.png)
[英]How do I make a button in an Ext.FormPanel be width=100% with red text?
[英]How can I make a button be the value in a Ext.FormPanel field row?
我有一個看起來像這樣的FormPanel:
var simple_form_left = new Ext.FormPanel({
frame:true,
labelWidth: 90,
labelAlign: 'right',
title: 'Customer Information',
bodyStyle:'padding:5px 5px 0',
width: 290,
height: 600,
autoScroll: true,
itemCls: 'form_row',
defaults: {width: 160},
defaultType: 'displayfield',
items: [{
...
現在,我想將此按鈕作為行之一的值放入:
var button = new Ext.Button({
text: "Click this",
handler: function() {
alert('pressed');
}
});
但是,當我將其添加為值時:
它只是將其顯示為一個對象:
我可以像這樣將其添加為完整字段行:
}, {
fieldLabel: 'Item 15',
name: 'item15',
value: 'test'
}, button, {
fieldLabel: 'Item 17',
name: 'item17',
value: 'test'
}, {
但這不是我想要的,因為它需要一個標簽:
如何添加按鈕來替換字段行中的文本?
謝謝@Tommi,這是我要與您的解決方案一起使用的代碼:
添加button
對象作為一個項目,而不是添加DisplayField
並且使按鈕value
的的DisplayField
。 並在該按鈕上添加一個FieldLabel
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.