1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    8
    Answers
    1
    Vote Rating
    0
    jaycmadison is on a distinguished road

      0  

    Default Answered: Grid CellEditing combobox editor beforeedit issue on ver 4.2

    Answered: Grid CellEditing combobox editor beforeedit issue on ver 4.2


    In ver 4.1.3 using the CellEditing plugin w/in the beforeedit event, we were able to reference the combobox editor of a column by using its id...Ext.getCmp('combobox_id'). We are no longer able to on ver 4.2. We get an error message that the component doesn't exist.

  2. See if the following will work for you:

    Code:
    Ext.define('ComboUser', {
        extend: 'Ext.form.field.ComboBox',
        alias: 'widget.combo-user',
        queryMode: 'local',
        valueField: 'name',
        displayField: 'name',
        store: {
            fields: [{ name: 'name', type: 'string' }],
            data: [
                { name: 'Lisa' },
                { name: 'Bart' },
                { name: 'Homer' },
                { name: 'Marge' }
            ]
        }
    });
    
    Ext.onReady(function(){
    
        Ext.create('Ext.data.Store', {
            storeId : 'simpsonsStore',
            fields  : ['name', 'email', 'change'],
            data    : {'items' : [
                { 'name' : 'Lisa',  'email' : 'lisa@simpsons.com',  'change' : 100  },
                { 'name' : 'Bart',  'email' : 'bart@simpsons.com',  'change' : -20  },
                { 'name' : 'Homer', 'email' : 'home@simpsons.com',  'change' : 23   },
                { 'name' : 'Marge', 'email' : 'marge@simpsons.com', 'change' : -11  }
            ]},
            proxy   : {
                type   : 'memory',
                reader : {
                    type : 'json',
                    root : 'items'
                }
            }
        });
    
        var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit: 1,
            listeners: {
                beforeedit: function(ed,e){
                    console.log(e.column.getEditor());
                }
            }
    
        });
    
        var grid = Ext.create('Ext.grid.Panel', {
            title      : 'Simpsons',
            store      : Ext.data.StoreManager.lookup('simpsonsStore'),
            columns    : [
                { header : 'Name', dataIndex : 'name', editor: 'combo-user' },
                { header : 'Email', dataIndex : 'email', flex : 1 },
                { header : 'Change', dataIndex : 'change' }
            ],
            height     : 200,
            width      : 400,
            plugins    : [ cellEditing ],
            renderTo   : Ext.getBody()
        });
    
    });
    Scott.

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,076
    Answers
    674
    Vote Rating
    467
    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


    See if the following will work for you:

    Code:
    Ext.define('ComboUser', {
        extend: 'Ext.form.field.ComboBox',
        alias: 'widget.combo-user',
        queryMode: 'local',
        valueField: 'name',
        displayField: 'name',
        store: {
            fields: [{ name: 'name', type: 'string' }],
            data: [
                { name: 'Lisa' },
                { name: 'Bart' },
                { name: 'Homer' },
                { name: 'Marge' }
            ]
        }
    });
    
    Ext.onReady(function(){
    
        Ext.create('Ext.data.Store', {
            storeId : 'simpsonsStore',
            fields  : ['name', 'email', 'change'],
            data    : {'items' : [
                { 'name' : 'Lisa',  'email' : 'lisa@simpsons.com',  'change' : 100  },
                { 'name' : 'Bart',  'email' : 'bart@simpsons.com',  'change' : -20  },
                { 'name' : 'Homer', 'email' : 'home@simpsons.com',  'change' : 23   },
                { 'name' : 'Marge', 'email' : 'marge@simpsons.com', 'change' : -11  }
            ]},
            proxy   : {
                type   : 'memory',
                reader : {
                    type : 'json',
                    root : 'items'
                }
            }
        });
    
        var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit: 1,
            listeners: {
                beforeedit: function(ed,e){
                    console.log(e.column.getEditor());
                }
            }
    
        });
    
        var grid = Ext.create('Ext.grid.Panel', {
            title      : 'Simpsons',
            store      : Ext.data.StoreManager.lookup('simpsonsStore'),
            columns    : [
                { header : 'Name', dataIndex : 'name', editor: 'combo-user' },
                { header : 'Email', dataIndex : 'email', flex : 1 },
                { header : 'Change', dataIndex : 'change' }
            ],
            height     : 200,
            width      : 400,
            plugins    : [ cellEditing ],
            renderTo   : Ext.getBody()
        });
    
    });
    Scott.

  4. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    8
    Answers
    1
    Vote Rating
    0
    jaycmadison is on a distinguished road

      0  

    Default


    Thank you Scott! That did the trick.

    Using e.column.getEditor() was able to get the reference to the combobox component.

Thread Participants: 1

Tags for this Thread