EXTJS 5.1非常简单的小部件列

时间:2015-03-09 15:13:45

标签: javascript extjs grid widget

我有一个简单的网格,其中一个小部件列显示一个组合框。我想根据绑定记录设置组合商店。

这是一个非常简单的小提示,可以演示我的问题:https://fiddle.sencha.com/#fiddle/jb7

这是相同的代码:

var userStore = Ext.create('Ext.data.Store', {
    fields: ['firstname', 'ownedCars'],
    data : [{
        "firstname": "jean",
        "ownedCars": [{
            "id": 12,
            "name": "punto"
        },{
            "id": 28,
            "name": "civic"
        }]
    }, {
        "firstname": "michel",
        "ownedCars": [{
            "id": 23,
            "name": "polo"
        },{
            "id": 58,
            "name": "bmw"
        }]
    }]
});


Ext.create('Ext.grid.Panel', {
    renderTo: Ext.getBody(),
    store: userStore,
    width: 500,
    autoHeight: true,
    title: 'Users cars grid',

    columns: [{
        text: 'Firstname',
        flex: 1,
        dataIndex: 'firstname'
    },{
        xtype: 'widgetcolumn',
        text: 'Cars',
        flex: 1,
        dataIndex: 'ownedCars',
        widget: {
            xtype: 'combo',
            displayField: 'name',
            valueField: 'id'
            // store: How to set the store of the combo depending on the record
        }
    }]    
});

提前致谢!!

0 个答案:

没有答案