1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    1
    Vote Rating
    0
    Michael7101 is on a distinguished road

      0  

    Default Unanswered: ComboBox shows value on drop down.

    Unanswered: ComboBox shows value on drop down.


    I have a combo box in a grid and when I drop down the selector A value still appears in the field. The value is the id and not the display value however. So if my box has Yes No value I will see the value of 1 or 0 (or true and false if datatype is bool) in the field. Its kind of confusing. Does anyone know how to fix that or make the value clear during selection. Thanks,

    Here is my grid combobox code/;

    {
    id: 'idenabled',
    header: 'Enabled',
    width: 60,
    dataIndex: 'enabled',
    value: '',
    valueField:'id',
    displayField:'value',
    disabled: false,
    editor:
    { xtype: 'combobox',
    typeAhead: false,
    // hideactive: true,
    disabled: false,
    selectOnTab: true,
    triggerAction: 'all',
    fields:['id','value'],
    store: BSSEnabledStore,
    value: '',
    valueField:'id',
    displayField:'value',
    multiSelect: false,
    queryMode: 'local',
    lazyRender: true,
    listClass: 'x-combo-list-small',


    listeners: {
    expand: function(){
    alert('e clicked');
    }
    }


    },
    renderer: function(val) {var matching = BSSEnabledStore.queryBy( function(rec){ return rec.data.id == val; }); return (matching.items[0]) ? matching.items[0].data.value : ''}
    }


    Screen Shot 2013-07-02 at 3.10.31 PM.png

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,770
    Answers
    355
    Vote Rating
    165
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    Try setting the valueField to 'value' as well:

    Code:
    Ext.create('Ext.data.Store', {
        storeId:'simpsonsStore',
        fields:['name', 'email', 'phone'],
        data:{'items':[
            {"name":"Lisa", "email":"lisa@simpsons.com", "phone":"555-111-1224"},
            {"name":"Bart", "email":"bart@simpsons.com", "phone":"555-222-1234"},
            {"name":"Homer", "email":"home@simpsons.com", "phone":"555-222-1244"},
            {"name":"Marge", "email":"marge@simpsons.com", "phone":"555-222-1254"}
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'items'
            }
        }
    });
    
    
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [
            {header: 'Name',  dataIndex: 'name', editor: 'textfield'},
            {header: 'Email', dataIndex: 'email', flex:1,
                editor: {
                    xtype: 'combobox',
                    editable: false,
                    forceSelection: true,
                    store: {
                        fields: ['id', 'value'],
                        data: [{
                            id: '1',
                            value: 'Yes'
                        }, {
                            id: '0',
                            value: 'No'
                        }]
                    },
                    valueField: 'value',
                    displayField: 'value',
                    queryMode: 'local',
                    listClass: 'x-combo-list-small',
                    listeners: {
                        expand: function () {
                            //alert('e clicked');
                        }
                    }
                }
            },
            {header: 'Phone', dataIndex: 'phone'}
        ],
        selType: 'cellmodel',
        plugins: [
            Ext.create('Ext.grid.plugin.CellEditing', {
                clicksToEdit: 1
            })
        ],
        height: 200,
        width: 400,
        renderTo: Ext.getBody()
    });
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar