有什么方法可以将ExtJS(版本4)ComboBox的下拉菜单的宽度设置为比实际输入框的宽度还要宽?
我有一个comboxbox,我希望宽度约为200像素,但是我对结果下拉菜单进行了分页,并且宽度甚至还不足以显示所有分页栏的控件。
这是我创建组合的代码:
var add_combo = Ext.create('Ext.form.field.ComboBox',
{
id : 'gbl_add_combo',
store : Ext.create('Ext.data.Store',
{
remoteFilter : true,
fields : ['gb_id', 'title'],
proxy :
{
type : 'ajax',
url : 'index.php/store/get_items',
reader :
{
type : 'json',
root : 'records',
totalProperty : 'total',
successProperty : 'success'
},
actionMethods :
{
read : 'POST',
create : 'POST',
update : 'POST',
destroy : 'POST'
}
}
}),
listConfig:
{
loadingText: 'Searching...',
emptyText: 'No results found'
},
queryMode : 'remote',
hideLabel : true,
displayField : 'title',
valueField : 'gb_id',
typeAhead : true,
hideTrigger : true,
emptyText : 'Start typing...',
selectOnFocus : true,
width : 225,
minChars : 3,
cls : 'header_combo',
pageSize : 15
});
最佳答案
这有两个部分。首先,您需要在组合框配置中设置matchFieldWidth:false。然后,您可以在listConfig部分中指定width属性,以仅对下拉菜单进行样式设置,同时在主配置中指定组合框本身的宽度。
这与以前的版本有所不同,后者仅允许您指定listWidth属性。
关于javascript - ExtJS ComboBox下拉宽度宽于输入框宽度吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6180025/