Combobox 网格内的Extjs组合框
我有一个包含一些数据的网格(用户列表)。对于每一行,我都有许多操作,如更新、删除、激活、挂起、查看您指定的顺序 我想放置一个组合框,在每个字段中应用一个操作,而不是放置这么多按钮,这些按钮将填充400-500像素以上的像素 问题是,我不能像那样简单地在列行中呈现一个组合框,或者我遗漏了什么?有人能解释一下吗Combobox 网格内的Extjs组合框,combobox,extjs,Combobox,Extjs,我有一个包含一些数据的网格(用户列表)。对于每一行,我都有许多操作,如更新、删除、激活、挂起、查看您指定的顺序 我想放置一个组合框,在每个字段中应用一个操作,而不是放置这么多按钮,这些按钮将填充400-500像素以上的像素 问题是,我不能像那样简单地在列行中呈现一个组合框,或者我遗漏了什么?有人能解释一下吗 new Ext.grid.GridPanel({ region: 'center', id: 'usersGrid', store: store, strip
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'
})
}
]
});
你所做的努力基本上是正确的。添加自定义编辑器的方式可能需要一些调整。。你试过这种改变吗
editor: new Ext.form.ComboBox({
store: new Ext.data.SimpleStore({
id: 0,
不幸的是,我无法确定您的代码在做什么,不起作用
您使用的是什么版本的ExtJS?值得注意的是,我发现在当前的ExtJSAPI文档中没有看到任何名为Ext.data.SimpleStore的对象。您是否尝试过使用不同类型的数据存储?您可能想尝试为此组合使用不同类型的存储
对当我们决定使用编辑器网格时,您是对的。还有一个问题是编辑器网格需要点击它的单元格来显示组合框,而这不是我想要的。目前,我遇到了一些问题,谁张贴这个问题。我希望我的网格最初显示组合框,以便用户理解他们可以从组合框中选择操作。我使用的是extjs 3.3.1,您应该将单元格的样式设置为组合框。实际上,您只有一个单件组合框可以使用EditorGrid编辑单元格,因此您需要使单元格看起来像组合框,以获得所需的效果。(无论如何,这比渲染大量组合框要快得多。)
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'
}
}]
});