1. #1
    Touch Premium Member
    Join Date
    Jul 2011
    Location
    Cuernavaca, Mexico
    Posts
    53
    Answers
    2
    Vote Rating
    1
    ErnestoR is on a distinguished road

      0  

    Default Answered: MVC RowEditor Cancel Event

    Answered: MVC RowEditor Cancel Event


    Hello Forum,

    I have a simple Grid Panel with the Roweditor plugin and I'm trying to listen to the event canceledit from a controller but it isn't firing.

    GridPanel
    Code:
    Ext.define('Mx.view.grupoListGridPanel',{
        extend: 'Ext.grid.Panel',
        alias: 'widget.grupoListGridPanel',
        title: 'Grupo',
        store: 'grupo.queryGrupoAll',
        plugins: [{
            ptype: 'rowediting',
            clicksToEdit: 2,
            autoCancel: false
        }],
        columns: [
            {
                header: 'ID',
                dataIndex: 'id'            
            },
            {
                header: 'Nombre',
                dataIndex: 'nombre',
                editor: {
                    xtype: 'textfield',
                    allowBlank: false
                }
            },
            {
                header: 'Descripcion',
                dataIndex: 'descripcion',
                editor: {
                    xtype: 'textfield',
                    allowBlank: false
                }
            }
        ]
    });
    Controller
    Code:
    Ext.define('Mx.controller.prospectoController',{
        extend: 'Ext.app.Controller',
        models:[
            'grupo.grupoAll'
        ],
        stores:[
            'grupo.queryGrupoAll'
        ],
        views: [
            'grupoListGridPanel'
        ],
        init: function() {
            this.control({
                 'grupoListGridPanel' :{
                    edit: this.afterGrupoEdit,
                    canceledit: this.onCancelGrupoEdit
                }
            });
        },
        
        afterGrupoEdit: function(grid){
            console.log(grid);
            console.log('after edit');
            this.getGrupoQueryGrupoAllStore().sync();
        },
        
        onCancelGrupoEdit: function(){
            console.log('cancel');
        }
    });
    The wierd thing is that the event edit IS firing and according to the documentation its fired by the plugin but it won't work with the event canceledit.

    Am I doing something wrong??

  2. What version of Ext do you use?
    • With 4.0.2a: the rowEditor plugin won't fire 'cancelEdit' event at all.
    • With 4.0.7: the plugin fires 'cancelEdit' event but the grid won't relay it so your controller can't not catch it.
    • 4.1.0-b1: the plugin fires 'cancelEdit' event and the grid relay this event so your controller can catch it.

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    What version of Ext do you use?
    • With 4.0.2a: the rowEditor plugin won't fire 'cancelEdit' event at all.
    • With 4.0.7: the plugin fires 'cancelEdit' event but the grid won't relay it so your controller can't not catch it.
    • 4.1.0-b1: the plugin fires 'cancelEdit' event and the grid relay this event so your controller can catch it.

  4. #3
    Touch Premium Member
    Join Date
    Jul 2011
    Location
    Cuernavaca, Mexico
    Posts
    53
    Answers
    2
    Vote Rating
    1
    ErnestoR is on a distinguished road

      0  

    Default


    Quote Originally Posted by vietits View Post
    What version of Ext do you use?
    I'm using Ext 4.0.7
    So its a bug ok.
    I've managed to do a little work around in the plugin configuration:
    Code:
    plugins: [{
            ptype: 'rowediting',
            clicksToEdit: 2,
            autoCancel: false,
            listeners: {
                canceledit: function(view){
                    view.grid.fireEvent('canceledit', this);
                }
           }
        }]
    Thanks!!!

  5. #4
    Sencha User
    Join Date
    Jul 2012
    Location
    Curitiba, PR
    Posts
    1
    Vote Rating
    0
    igordiuk is on a distinguished road

      0  

    Default Great Job

    Great Job


    Thank's for this post!