1. #1
    Sencha User
    Join Date
    Jan 2011
    Posts
    16
    Answers
    1
    Vote Rating
    0
    mcryan is on a distinguished road

      0  

    Default Answered: Combobox in editable Gridpanel not displaying displayField

    Answered: Combobox in editable Gridpanel not displaying displayField


    Not sure if this should be posted in the bugs section or if I am missing something obvious here.

    As the title suggests, I have a combobox in a grid with cell editing. Once I select an option from the combo, the cell is updated with the valueField rather than the configured display field, though the dropdown is correctly displaying the displayField

    Here is my code:
    Code:
    Ext.define('Grid', {
        extend: 'Ext.grid.Panel',
        requires: [
            'Ext.grid.plugin.CellEditing',
            'Ext.form.field.Text',
            'Ext.toolbar.TextItem'
        ],
    
    
        initComponent: function() {
            this.editing = Ext.create('Ext.grid.plugin.CellEditing');
            Ext.apply(this, {
                iconCls: 'icon-grid',
                frame: false,
                plugins: [this.editing],
                columns: [{
                    text: 'ID',
                    width: 40,
                    sortable: true,
                    dataIndex: 'id',
                    hidden: true
                }, {
                    header: 'Type',
                    width: 120,
                    sortable: true,
                    dataIndex: 'type',
                    field: {
                        xtype: 'combobox',
                        queryMode: 'local',
    				    store: new Ext.data.ArrayStore({
    				        id: 0,
    				        fields: [
    				            'id',
    				            'name'
    				        ],
    				        data: [[1, 'Email'], [2, 'SMS']]
    				    }),
    				    valueField: 'id',
    				    displayField: 'name',
    				    triggerAction: 'all'
                    }
                }]
            });
            this.callParent();
        }
    });

  2. That turned out to be extremely easy... Thanks

    Code:
    renderer: function(value) {
        return value == 1 ? 'Email' : 'SMS';
    }

  3. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Answers
    130
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    sounds a bit like a feature request.

    i normally create a custom renderer for such grid-columns and let them address the same store the combo has (matching value to displayField)


    best regards
    tobiu
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  4. #3
    Sencha User
    Join Date
    Jan 2011
    Posts
    16
    Answers
    1
    Vote Rating
    0
    mcryan is on a distinguished road

      0  

    Default


    I didn't think it was a feature request as I only want the combo to behave as it does outside of a grid, I thought that would be expected?

    Anyhow, I will throw a renderer in there and see what happens. Thanks...

  5. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    16
    Answers
    1
    Vote Rating
    0
    mcryan is on a distinguished road

      0  

    Default


    That turned out to be extremely easy... Thanks

    Code:
    renderer: function(value) {
        return value == 1 ? 'Email' : 'SMS';
    }

Thread Participants: 1