在组合框中填充级联数据

时间:2014-09-16 06:58:13

标签: extjs

以下是fiddle

我试图搜索我遇到的问题,但找不到任何有用的东西。

我有一家商店:

var store = Ext.create('Ext.data.Store', {
storeId: 'employeeStore',
model: 'User',
groupField: 'CRDS',
autoLoad: true,
data: {
    'employees': [{
        "CRDS": "ABBCAMS",
        "SelBg": "TEST1",
        "ALLBGs": [{
            "ID": 10,
            "BG": "TEST1"
        }, {
            "ID": 20,
            "BG": "TEST2"
        }, {
            "ID": 30,
            "BG": "TEST3"
        }],
        "excl": 1,
        "unlc_acc": 0,
        "susp_acc": 0,
        "blck_acc": 0,
        "agency": 0,
        "tryimg": "img/trend-down.png"
    }, {
        "CRDS": "ABBCAMS",
        "SelBg": "TEST4",
        "ALLBGs": [{
            "ID": 10,
            "BG": "TEST1"
        }, {
            "ID": 20,
            "BG": "TEST2"
        }, {
            "ID": 30,
            "BG": "TEST3"
        }],
        "excl": 1,
        "unlc_acc": 0,
        "susp_acc": 0,
        "blck_acc": 0,
        "agency": 0,
        "tryimg": "img/trend-down.png"
    }, {
        "CRDS": "BARCLON",
        "SelBg": "TEST7",
        "ALLBGs": [{
            "ID": 10,
            "BG": "TEST1"
        }],
        "excl": 0,
        "unlc_acc": 1,
        "susp_acc": 1,
        "blck_acc": 1,
        "agency": 1,
        "tryimg": "img/trend-down.png"
    }, {
        "CRDS": "SOGEPAR",
        "SelBg": "TEST9",
        "ALLBGs": [{
            "ID": 10,
            "BG": "TEST1"
        }, {
            "ID": 20,
            "BG": "TEST2"
        }, {
            "ID": 30,
            "BG": "TEST3"
        }],
        "excl": 0,
        "unlc_acc": 1,
        "susp_acc": 1,
        "blck_acc": 1,
        "agency": 1,
        "tryimg": "img/trend-down.png"
    }, {
        "CRDS": "CRITGOA",
        "SelBg": "TEST3",
        "ALLBGs": [{
            "ID": 10,
            "BG": "TEST1"
        }, {
            "ID": 20,
            "BG": "TEST2"
        }, {
            "ID": 30,
            "BG": "TEST3"
        }],
        "excl": 0,
        "unlc_acc": 1,
        "susp_acc": 1,
        "blck_acc": 1,
        "agency": 1,
        "tryimg": "img/trend-down.png"
    }]
}
});

我希望能够在列表框中加载子集ALLBG。我无法弄清楚如何解决这个问题。以下是我的ATM:

xtype: 'grid',
columns: [
    {
        text: 'GCL ORG ID',
        dataIndex: 'SelBg',
        renderer: function(store, record, rowIndex, value) {return Ext.getStore('employeeStore').data.items[value].data.SelBg;},
        editor: new Ext.form.field.ComboBox({
            id: 'bg1',
            typeAhead: true,
            triggerAction: 'all',
            selectOnTab: true,
            displayField: 'BG',
            valueField:'ID',
            // NEED DYNAMIC STORE ALLBGs HERE
            store: [
                ['Shade','ABCD'],
                ['Mostly Shady','Mostly Shady'],
                ['Sun or Shade','Sun or Shade'],
                ['Mostly Sunny','Mostly Sunny'],
                ['Sunny','Sunny']
            ],
            lazyRender: true,
            listClass: 'x-combo-list-big'
        })
    }

谢谢, 满足

1 个答案:

答案 0 :(得分:0)

我能够通过在运行时创建商店来实现。作为参考,我也在fiddle中应用了相同的更改。