gpt4 book ai didi

EXTJS,应用布局时出现问题

转载 作者:行者123 更新时间:2023-12-02 06:43:55 25 4
gpt4 key购买 nike

当我使用列布局时,看不到我的 labelFields我的字段在 cols 中,但没有标签

var familyNameTextField = new Ext.form.TextField({
fieldLabel : 'Ville',
allowBlank:false,
id : 'familyName'
});
var myData = [['EDF','EDF'],['GDF','GDF']];

//The text field for the First Name
var firstNameTextField = new Ext.form.ComboBox({
fieldLabel: 'State',
hiddenName:'state',
store: new Ext.data.ArrayStore({
fields: ['abbr', 'state'],
data : myData // from states.js
}),
valueField:'abbr',
displayField:'state',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
width:190
});
//The text field for the First Name
var demarcheField = new Ext.form.TextField({
fieldLabel : 'Démarche',
allowBlank:false,
id : 'demarche'
});
//Button to show the MessageBox
var showMessageBoxBouton = new Ext.Button({
text:'Say Hello',
handler:showMessageBox //The function that will be called when the button is clicked
});
//The form that will contain all our components
var myForm = new Ext.FormPanel({
labelWidth: 115,
frame:true,
title: 'Personal informations',
bodyStyle:'padding:5px 5px 0',
width: 900,
autoScroll:true,
layout:'column',
items: [{
items:[
familyNameTextField
]
},
{
items:[firstNameTextField]
},
{
items:[demarcheField]
},
{
items:[showMessageBoxBouton]
}
]
});

最佳答案

您看不到标签,因为您将 FormPanel 的默认布局 - FormLayout - 替换为 ColumnLayout。

来自 FormPanel 文档:

By default, FormPanel is configured with layout:'form' to use an Ext.layout.FormLayout layout manager, which styles and renders fields and labels correctly. When nesting additional Containers within a FormPanel, you should ensure that any descendant Containers which host input Fields use the Ext.layout.FormLayout layout manager.

因此,在列布局中嵌套带有 layout:'form' 的容器,您将看到标签

关于EXTJS,应用布局时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3460015/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com