我最近将我的Ext版本从4.0.7升级到4.1
我使用“tbar”配置在顶部连接了网格组合。 现在我面临的问题是,即使有数据或没有数据,我的组合也没有采取适当的宽度。我给了宽度然后它也没有正常工作。
我附上图片以供参考,请有一个战利品。
这是我的网格代码
Ext.create('Ext.grid.Panel', {
id: 'SourceGridPanelId',
forceFit: true,
autoScroll:true,
store: sourceGridStore,
sortableColumns:false,
enableColumnHide:false,
tbar: createSourceSiteCombo(sourceSiteStore)
这是我的组合代码
var sourceCombo= Ext.create('Ext.form.ComboBox', {
id: "sourceSiteID",
fieldLabel:'Select Site',
inputId: "sourceSiteID_input",
store: sourceSiteStore,
queryMode: 'local',
displayField: 'sourceSiteName',
valueField: 'sourceSiteId',
width:200
});
请在此处提出建议。
var combo=Ext.create('Ext.form.ComboBox',
{
multiSelect : false,
id:'SelectComponentId',
name:'SelectComponentId',
allowBlank: true,
inputId:'SelectComponentId_input',
hideTrigger: false,
editable: false,
selectOnFocus: false,
typeAhead: false,
disabled: false,
readOnly: false,
width: 312,
store: [['-1','Select User'],['59','Yagna Tel Clear']],
value:'-1',
renderTo:'UserBO_SelectComponentId_Div',
triggerAction: 'all'
});
在上面的代码如果我删除宽度它工作正常,但采取默认宽度,但我想分配宽度。 请建议这里缺少什么
答案 0 :(得分:2)
宽度包括labelWidth
。
因此,如果您的字段标签有宽度,例如200,你希望字段的宽度也是200,你需要将宽度设置为400(+边距)
答案 1 :(得分:0)
我有同样的问题。你需要从组合框配置中取出字段标签,而不是以这种方式设置它,在fieldname的工具栏中有一个文本对象:
dockedItems: [
{
xtype: "toolbar",
dock: "top",
items: [
{
xtype: "tbtext",
style: "font-weight:bold;",
text: "Select Site:"
},
createSourceSiteCombo(sourceSiteStore)
]
}
]
我相信从fieldLabel创建的fieldLabel dom对象由于某种原因搞砸了工具栏渲染。
(停靠项取代了tbar,现在是创建工具栏的标准方法。)