0

I have a simple grid, with a widget column that displays a combobox. I would like to set the combo store depending on its bound record.

Here is a very simple fiddle that demonstrates my problem: https://fiddle.sencha.com/#fiddle/jb7

And here is the same code:

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
        }
    }]    
});

Thanks in advance !!

JkSuf
  • 343
  • 1
  • 6
  • 22
  • Do you want to edit a value in the grid record with the combo? If so, don't use widget column but cell editing plugin. – Saki Mar 10 '15 at 08:51
  • Yes as @Saki said have a look at this http://stackoverflow.com/questions/17719842/extjs-how-to-show-combobox-in-grid-column – Rob Schmuecker Mar 10 '15 at 09:08
  • Hi guys, thanks for your answers :) !! I know about the edit cell plugin and the getEditor/editor property of a column, and this is not the behaviour I wanted. I really need to display the combo right away just like in your example Rob. And I found (after many many tries) how to do it (using onWidgetAttach): http://www.sencha.com/forum/showthread.php?298937-VERY-SIMPLE-Widget-column&p=1091740#post1091740 – JkSuf Mar 10 '15 at 15:27

0 Answers0