javascriptdojoedit-in-place

Using ComboBox with InlineEditBox


I'm trying to use InlineEditBox together with the following 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()

My first 'naive' approach was:

new InlineEditBox({
  store: new Memory({data: items}),
  searchAttr: 'value',
  style: 'width: 200px;',
  editor: ComboBox
}, 'status').startup()  

As the effect, there was the inline box shown, which you could click, but empty ComboBox shown up. I've tried an approach from Nabble's forum:

new InlineEditBox({
  editor: new ComboBox({
  store: new Memory({data: items}),
  searchAttr: 'value',
  style: 'width: 200px;',
})}, 'status').startup()

However, it doesn't work as well.

My question: is there a way to use the dijit/InlineEditBox together with dijit controls other than simple text editors, of that component is simply written to cooperate only with a few supported controls?


Solution

  • I've found an answer: you need to use editorParams. This parameter is the object with attributes that are given to the editor. It's not directly documented on Dojo docs, but it's used in the examples.

    The working ComboBox with InlineTextEdit:

      new InlineEditBox({
        editor: ComboBox,
        editorParams: {
          store: new Memory({data: items}),
          searchAttr: 'name'
        }
      }, 'type').startup()