How to use Ext5 combobox with data bindings

纵然是瞬间 提交于 2020-01-12 05:45:06

问题


I want to use a combobox which receives the preselected value from a data binding and also the possible options from a data binding of the same store. The panel items configuration looks like this:

{
    xtype: 'combobox',
    name: 'language_default',
    fieldLabel: 'Default Language',
    multiSelect: false,
    displayField: 'title',
    valueField: 'language_id',
    queryMode: 'local',
    bind: {
        value: '{database.language_default}',
        store: '{database.languages}'
    }
}

If I use this configuration, the store of the combobox is invalid and unuseable.

Is it possible to bind the selected option and also the available options of a combobox?


回答1:


Upgrade to ExtJs 5.0.1 and you can use selection binding

{
    xtype: 'combobox',
    name: 'language_default',
    fieldLabel: 'Default Language',
    multiSelect: false,
    displayField: 'title',
    valueField: 'language_id',
    queryMode: 'local',
    bind: {
        value: '{database.language_id}',
        selection: '{database.language_default}',
        store: '{database.languages}'
    }
}


来源:https://stackoverflow.com/questions/25264896/how-to-use-ext5-combobox-with-data-bindings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!