我正在尝试使用 InlineEditBox以及以下 dijit/form/ComboBox
:
var items = [
{name: 'new'},
{name: 'processed'},
{name: 'approved'},
{name: 'running'},
{name: 'archived'}
]
new ComboBox({
store: new Memory({data: items}),
searchAttr: 'name',
style: 'width: 200px;'
}, 'status').startup()
我的第一个“天真的”方法是:
new InlineEditBox({
store: new Memory({data: items}),
searchAttr: 'value',
style: 'width: 200px;',
editor: ComboBox
}, 'status').startup()
作为效果,显示了内联框,您可以单击它,但显示空的 ComboBox。我尝试过 Nabble's forum 中的方法:
new InlineEditBox({
editor: new ComboBox({
store: new Memory({data: items}),
searchAttr: 'value',
style: 'width: 200px;',
})}, 'status').startup()
但是,它的效果并不好。
我的问题:除了简单的文本编辑器之外,有没有办法将 dijit/InlineEditBox 与 dijit 控件一起使用,该组件只是编写为仅与少数受支持的控件配合?
最佳答案
我找到了答案:您需要使用editorParams
。此参数是具有赋予编辑器的属性的对象。它没有直接记录在 Dojo 文档中,但在示例中使用。
带有 InlineTextEdit 的工作组合框:
new InlineEditBox({
editor: ComboBox,
editorParams: {
store: new Memory({data: items}),
searchAttr: 'name'
}
}, 'type').startup()
关于javascript - 将 ComboBox 与 InlineEditBox 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24187045/