如何将 Ext5 组合框与数据绑定一起使用 [英] How to use Ext5 combobox with data bindings

查看:24
本文介绍了如何将 Ext5 组合框与数据绑定一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用一个组合框,它接收来自数据绑定的预选值以及来自同一存储的数据绑定的可能选项.面板项配置如下所示:

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}'
    }
}

如果我用这个配置,combobox的store是无效的,无法使用.

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?

推荐答案

升级到 ExtJs 5.0.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}'
    }
}

这篇关于如何将 Ext5 组合框与数据绑定一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆