[英]Button near textfield dont show in form inside a tabpanel
Im creating a Form with tabs in Ext-JS 5.0.1. 我在Ext-JS 5.0.1中创建带有选项卡的表单。
In the first tab i want to put a button near the two first textfields but when i try to insert two items (one textfield and one button) the textfield use 100% of width, not show the fieldlabel and the button dont show too. 在第一个选项卡中,我想在两个第一个文本字段附近放置一个按钮,但是当我尝试插入两个项目(一个文本字段和一个按钮)时,文本字段使用100%的宽度,不显示fieldlabel,也不显示按钮。 What im doing wrong?
我在做什么错? this is my code and a pic of the result.
这是我的代码和结果图片。
var form_datosdoc = new Ext.form.Panel ({
bodyPadding: 10,
defaultType: 'textfield',
items: [
{
items: [{
layout: "form",
items: {
fieldLabel: "Representante",
xtype: "textfield",
name: 'representante'
}
},{
items: {
xtype: 'button',
text: 'Click me'
}
}]
},
{
fieldLabel: 'Aprobador',
name: 'aprobador'
},
{
xtype: 'datefield',
fieldLabel: 'Fecha',
name: 'fecha_doc',
value: new Date(), //Fecha de hoy
maxValue: new Date() //Máxima fecha la de hoy
}
]
})
var paneltab = new Ext.tab.Panel ({
width: window.innerWidth * 0.95,
height: window.innerHeight * 0.88,
xtype: 'tabpanel',
title: '<bean:message key="label.AGR.analisisgr.documento" />',
tabPosition:'left',
textAlign:'right',
tabRotation: 0,
renderTo: 'contenedor',
items: [{
title: 'Datos del documento',
tooltip: 'Datos del documento',
layout: 'fit',
items: [form_datosdoc]
},{
title: 'Listado de activos',
tooltip: 'Listado de activos + Valoracion CID',
html: 'Ejemplo2'
},{
title: 'Tipos de activo',
tooltip: 'Activos por tipo de activo',
html: 'Ejemplo3'
},{
title: 'Amenazas',
tooltip: 'Listado de amenazas',
html: 'Ejemplo4'
},{
title: 'Salvaguardas',
tooltip: 'Listado de salvaguardas',
html: 'Ejemplo5'
},{
title: 'Amenazas por riesgo',
tooltip: 'Listado de amenazas por riesgo y salvaguardas asociadas',
html: 'Ejemplo6'
},{
title: 'Activos por riesgo',
tooltip: 'Listado de activos por riesgo, amenazas asociadas y salvaguardas asociadas a las amenazas',
html: 'Ejemplo7'
}]
});
Thank you in advance 先感谢您
You need to specify the layout
property and also make a wrapping container
for both of those items as currently is ould assume it is of time texfield
as you have that set for the defaultType
您需要指定
layout
属性,并为这两个项目都创建一个包装container
,因为当前应该假定它是texfield
时间,因为您已为defaultType
设置了该时间
items: [{
xtype: 'container',
layout: "hbox",
items: [{
items: {
fieldLabel: "Representante",
xtype: "textfield",
name: 'representante'
}
}, {
items: {
xtype: 'button',
text: 'Click me'
}
}]
}, {
fieldLabel: 'Aprobador',
name: 'aprobador'
}, {
xtype: 'datefield',
fieldLabel: 'Fecha',
name: 'fecha_doc',
value: new Date(), //Fecha de hoy
maxValue: new Date() //Máxima fecha la de hoy
}]
Demo: https://fiddle.sencha.com/#fiddle/j2l 演示: https : //fiddle.sencha.com/#fiddle/j2l
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.