1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    21
    Answers
    1
    Vote Rating
    0
    Forza Bo is on a distinguished road

      0  

    Default Answered: CellEditing Listener...

    Answered: CellEditing Listener...


    I must be doing something really dumb, but I can't figure out how to get Ext.grid.plugin.CellEditing to respond an the edit event. Or any event. I must not be adding the listener correctly. Or in the right place. Or something.

    Here's one of the many things I've tried (fragment):

    Code:
    items: [{                    xtype: 'grid',
                        title: 'plans',
                        store: me.plans,
                        columns: [
                            { header: 'id',  dataIndex: 'id', width : 32},
                            { header: 'Name',  dataIndex: 'name', flex: 1, field : 'textfield' },
                            { header: 'Description', dataIndex: 'description', flex: 1, field : 'textfield'},
                            { header: 'System', dataIndex: 'system_name', flex: 1, field : 'textfield',}
                            ],
                            selType: 'cellmodel',
                            plugins: [
                                Ext.create('Ext.grid.plugin.CellEditing', {
                                    clicksToEdit: 2,
                                    listeners: [
                                        {edit: function(){console.log("booooo")}}
                                    ] 
                                })
                            
                            ],
                            
                        }],
    What I would like to do is allow the inline editing function on most cells, but override on a few others. For example, The system name column needs to correlate to a system id table... anyway...

  2. See if this works for you:

    Code:
    Ext.onReady(function(){
     
        var store = Ext.create('Ext.data.Store', {
            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 editor = {
            xtype: 'textfield',
            allowBlank: false
        };
    
        var columns = [
            { header : 'Name', dataIndex : 'name', locked: true, editor: editor },
            { header : 'Email', dataIndex : 'email', flex : 1, editor: editor },
            { header : 'Change', dataIndex : 'change', editor: editor }
        ];
    
        var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit: 1,
            listeners: {
                edit: function(){
                    console.log('boo-who?');
                }
            }
            
        });
    
        var grid = Ext.create('Ext.grid.Panel', {
            title      : 'Simpsons',
            store      : store,
            columns    : columns,
            height     : 200,
            width      : 400,
            renderTo   : Ext.getBody(),
    
            plugins: [ cellEditing ]
        });
    
    });
    console:
    > boo-who?
    Scott.

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,918
    Answers
    655
    Vote Rating
    443
    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 this works for you:

    Code:
    Ext.onReady(function(){
     
        var store = Ext.create('Ext.data.Store', {
            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 editor = {
            xtype: 'textfield',
            allowBlank: false
        };
    
        var columns = [
            { header : 'Name', dataIndex : 'name', locked: true, editor: editor },
            { header : 'Email', dataIndex : 'email', flex : 1, editor: editor },
            { header : 'Change', dataIndex : 'change', editor: editor }
        ];
    
        var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit: 1,
            listeners: {
                edit: function(){
                    console.log('boo-who?');
                }
            }
            
        });
    
        var grid = Ext.create('Ext.grid.Panel', {
            title      : 'Simpsons',
            store      : store,
            columns    : columns,
            height     : 200,
            width      : 400,
            renderTo   : Ext.getBody(),
    
            plugins: [ cellEditing ]
        });
    
    });
    console:
    > boo-who?
    Scott.

  4. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    21
    Answers
    1
    Vote Rating
    0
    Forza Bo is on a distinguished road

      0  

    Default


    Scott,

    Thank you for the working example. My mistake was adding square brackets around the listeners argument. I am still a little fuzzy why it shouldn't get brackets whereas items, for instance, does... but it doesn't matter, it works!

    Thanks again,

    --Bo

  5. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,918
    Answers
    655
    Vote Rating
    443
    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


    A listeners is an object, whereas items is an object or array of objects.

    Scott.

  6. #5
    Sencha User
    Join Date
    Feb 2012
    Posts
    21
    Answers
    1
    Vote Rating
    0
    Forza Bo is on a distinguished road

      0  

    Default


    Thank you for de-fuzzifying that for me, Scott!

    Cheers,

    --Bo

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi