gpt4 book ai didi

combobox - 网格内的 Extjs ComboBox

转载 作者:行者123 更新时间:2023-12-04 23:09:20 28 4
gpt4 key购买 nike

我有一个包含一些数据的网格(用户列表)。对于每一行,我有许多操作,例如更新、删除、激活、暂停、查看您命名的订单。

而不是放置如此多的按钮,这些按钮将填充超过 400-500像素 我想放置一个组合框,其中的 Action 应用于每个字段。

问题是我不能像那样简单地在列行中呈现组合框,或者我遗漏了什么?有人可以对此有所了解吗?

new Ext.grid.GridPanel({
region: 'center',
id: 'usersGrid',
store: store,
stripeRows: true,
autoExpandColumn: 'username',
columns: [{
// username
},{
// email
},{
// last seen
},{
// actions combo, it won't show
header: '',
width: 220,
fixed: true,
hideable: false,
dataIndex: 'actions',
renderer: new Ext.form.ComboBox({
store: new Ext.data.SimpleStore({
id: 0,
fields: ['abbr', 'action'],
data: [
['suspend', 'Suspend'],
['activate', 'Activate'],
['update', 'Update'],
['delete', 'Delete']
]
}),
displayField: 'action',
valueField: 'abbr',
mode: 'local',
typeAhead: false,
triggerAction: 'all',
lazyRender: true,
emptyText: 'Select action'
})
}
]
});

最佳答案

  1. Convert Grid to Editable Grid
  2. Add editor config in columns instead of 'renderer'. Find below the altered code.

new Ext.grid.EditorGridPanel({
region: 'center',
id: 'usersGrid',
store: store,
stripeRows: true,
autoExpandColumn: 'username',
columns: [{
// username
}, {
// email
}, {
// last seen
}, {
// actions combo, it won't show
header: '',
width: 220,
fixed: true,
hideable: false,
dataIndex: 'actions',
editor: {
xtype: 'combo',
store: new Ext.data.ArrayStore({
fields: ['abbr', 'action'],
data: [
['suspend', 'Suspend'],
['activate', 'Activate'],
['update', 'Update'],
['delete', 'Delete']
]
}),
displayField: 'action',
valueField: 'abbr',
mode: 'local',
typeAhead: false,
triggerAction: 'all',
lazyRender: true,
emptyText: 'Select action'
}
}]
});

关于combobox - 网格内的 Extjs ComboBox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4538735/

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