1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    27
    Vote Rating
    0
    genggeng13 is on a distinguished road

      0  

    Default How display combobox displayValue in RowEditing

    How display combobox displayValue in RowEditing


    Hi guy,

    i am using the plugin roweditor for my grid , my grid are able to show the displayField , but when i click to activate the roweditor , it will show the valueField in the editor combo box .

    May i know how to show the displayField as well in the row editor combo box

    here is my column code :

    Code:
    { header: 'ClaimType', dataIndex: 'ClaimType', field: {        
                           xtype: 'combobox',
                            queryMode: 'local',
                            store: stType,
                            displayField: 'text',
                            valueField: 'value',
                            lazyRender: true
                        }, renderer: rdrClaimType},
    My rendere is like this

    Code:
    function rdrClaimType(val) {     
       if(val == 1 ){
            return 'Travel';
        }
        else if(val == 2 ) {
            return 'Parking';
        }
       
        else if(val == 3 ) {
            return 'Refreshment';
        }
        else if (val == 4) {
            return 'Others';
        }
    }
    thank you

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,197
    Vote Rating
    482
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

  3. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,197
    Vote Rating
    482
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Here is a small example .. is displays the name in the combo:

    Code:
    var store = Ext.create('Ext.data.Store', {
        storeId:'simpsonsStore',
        fields:['id', 'name', 'email', 'change'],
        data:{'items':[
            { 'id': 1, 'name': 'Lisa',  "email":"lisa@simpsons.com",  "change":100  },
            { 'id': 2, 'name': 'Bart', "email":"bart@simpsons.com", "change":-20  },
            { 'id': 3, 'name': 'Homer', "email":"home@simpsons.com",  "change":23   },
            { 'id': 4, 'name': 'Marge', "email":"marge@simpsons.com", "change":-11   }
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'items'
            }
        }
    });
    
    var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
        clicksToMoveEditor: 1,
        autoCancel: false
    });
    
    var rowRenderer = function(val) {
        var myNames=['Lisa','Bart','Homer','Marge']; // dummy array from store data 
        return myNames[val-1]; // 0 based
    };    
    
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [
            { header: 'Combo', dataIndex: 'id', renderer: rowRenderer, editor:
            {
                xtype: 'combobox',
                store: store,
                queryMode: 'local',
                displayField: 'name',
                valueField: 'id'
            } 
            },
            { header: 'Name',  dataIndex: 'name' },
            { header: 'Email', dataIndex: 'email', flex: 1 },
            { header: 'Change', dataIndex: 'change' }
        ],
        height: 200,
        width: 400,
        renderTo: Ext.getBody(),
        plugins: [ rowEditing ]
    });
    Scott.

  4. #4
    Sencha User
    Join Date
    Mar 2012
    Posts
    27
    Vote Rating
    0
    genggeng13 is on a distinguished road

      0  

    Default


    Thank you scott

    i try with your example.

Thread Participants: 1