1. #1
    Sencha User
    Join Date
    Feb 2010
    Location
    Brescia
    Posts
    60
    Vote Rating
    0
    ladro1987 is on a distinguished road

      0  

    Exclamation rowEditing's plugin problem

    rowEditing's plugin problem


    Hi all,
    i've used the rowEditing for my grid. It's all right, but i've one problem.
    In extjs 3 i set the event " canceledit ". that's deprecated into extjs4.
    How can I set an alternative method for delete the recort that's I've create?

    In extjs3 this is approximately the methot that I've used:
    Code:
    rowEditing.on({
            scope: this,
            'canceledit' : {
                fn : function(roweditor, forced) {
                    if (roweditor.record)
                        if (roweditor.record.phantom === true)
                            store_categorie.reload();
                }
            },

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Location
    Prague
    Posts
    38
    Vote Rating
    0
    cubernatic is on a distinguished road

      0  

    Default


    Hi
    When I understand yout problem right, you want do delete the new generated record if the user press cancel button. OK.

    May a way should be to use the "on" Method to add a Listener for "click" event, where you check if the "cancel" button was pressed.

  3. #3
    Sencha User
    Join Date
    Feb 2010
    Location
    Brescia
    Posts
    60
    Vote Rating
    0
    ladro1987 is on a distinguished road

      0  

    Default


    hi,
    yes, that is my problem.
    Can you illustrate me one example of this listener please? I don't understand how this work.

  4. #4
    Sencha User
    Join Date
    Jun 2011
    Location
    Prague
    Posts
    38
    Vote Rating
    0
    cubernatic is on a distinguished road

      0  

    Default


    Ouh,
    I not so familiar with ExtJS but it's good described here:
    http://docs.sencha.com/ext-js/4-0/#/...ting-method-on

    Think it have to look this way. It's source from my grid view. I use the MVC pattern.
    Code:
    Ext.define('XTM.view.tax.TaxclassList' ,{
        extend: 'Ext.grid.Panel',
        alias : 'widget.TaxclassList',
        store : 'Taxclass',
        border: false,
        
        columns: [{
            header:     'id',
            dataIndex:  'tax_class_id',
            sortable:   false,
            hidden:     true
        },{
            header:     'Steuerklasse',  
            dataIndex:  'tax_class_title',  
            flex:       1,
            sortable:   true,
            hidden:     false,
            field: {
                type: 'textfield'
            }
        }],
    
        dockedItems: [{
            xtype: 'toolbar',
            dock: 'bottom',
            items: [{
                text: 'Add',
                iconCls: 'icon-add',
                disabled: false,
                action: 'add'
            }, {
                text: 'Delete',
                iconCls: 'icon-delete',
                disabled: true,
                itemId: 'delete',
                action: 'delete'
            }]
        }],
        initComponent: function() {
            this.editing = Ext.create('Ext.grid.plugin.RowEditing');
            this.editing.on('click', this.handleClick);
            Ext.apply(this, {
               plugins: [this.editing]
               
            });
            
    
            this.callParent(arguments);
        },
    
        handleClick: function() {
           here comes your code
        }
    
    });
    But this is also wrong for a MVC application, couse all functions have to been handled by the controller.
    If you are not usesing the MVC pattern you can use it this way.

  5. #5
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,099
    Vote Rating
    96
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    this is what i m using:

    Code:
    // Override the cancelEdit function of RowEditing plugin to insert canceledit event
    
    Ext.override(Ext.grid.plugin.RowEditing, {
    
        cancelEdit: function() {
    
            var me = this;
    
            if (me.editing) {
    
                me.getEditor().cancelEdit();
    
                me.callParent(arguments);
    
    
    
                this.fireEvent('canceledit', this);
    
            }
    
                    me.addnew = false;
    
        }
    
    });
    
    
    
    
    
    // Create RowEditing plugin rowEditing2
    
    var rowEditing2 = Ext.create('Ext.grid.plugin.RowEditing', {
    
        id:'rowEditing2',
    
        clicksToEdit: 2
    
    });
    
    
    
    // Remove record from store on canceledit from grid using rowEditing2 plugin
    
    rowEditing2.on('canceledit', function(me) {
    
        if(me.addnew)
    
            me.context.record.store.remove(me.context.record);    
    
    });
    and when you start editing:
    Code:
                    rowEditing.startEdit(grid.getStore().last(), 0);
    
                    rowEditing.addnew = true;
    
                    rowEditing.on('edit', function() {
    
                        Ext.getCmp('grid').getSelectionModel().deselectAll();    // Clear all selected entries of grid after add operation has been completed
    
                        rowEditing.addnew = false;
    
                    });

  6. #6
    Sencha User
    Join Date
    Dec 2009
    Location
    Enschede, The Netherlands
    Posts
    327
    Vote Rating
    13
    flanders will become famous soon enough

      0  

    Default


    This question has been asked before here and is promised to be addressed in 4.0.5 and i assume 4.1 when it arrives

  7. #7
    Sencha User
    Join Date
    Feb 2010
    Location
    Brescia
    Posts
    60
    Vote Rating
    0
    ladro1987 is on a distinguished road

      0  

    Default


    Thanks for the quick responce.

    I've know the concept but i ask una stupid question...

    Where i find the RowEditor's plugin?
    In the ux's folder there isn't the file.

  8. #8
    Sencha User
    Join Date
    Dec 2009
    Location
    Enschede, The Netherlands
    Posts
    327
    Vote Rating
    13
    flanders will become famous soon enough

      0  

    Default


    The roweditor is no longer an ux. It is now part of extjs itself.

    You can find the documentation here and an example here

  9. #9
    Sencha User
    Join Date
    Feb 2010
    Location
    Brescia
    Posts
    60
    Vote Rating
    0
    ladro1987 is on a distinguished road

      0  

    Default


    oook! Thx!!
    But I would know where I find the
    Code:
      Ext.override(Ext.grid.plugin.RowEditing, {
    Cited by Farish!

  10. #10
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,099
    Vote Rating
    96
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    you wont find it. you have to write this in your own javascript file.