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

      0  

    Default


    I have add in a new file javascript this code:
    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;      }  });
    After i have create the grid with rowediting with this code
    Code:
     // 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);      });
    but when i cancel the record nothing happens!

  2. #12
    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


    Try with this first:

    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);
            }
        }
    });
    
    // 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) {
      me.context.record.store.remove(me.context.record);    
    });
    Also make sure you are using the right plugin name in ur grid (rowEditing2 here) and have included the new JS file in your HTML file!

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

      0  

    Default


    Yes!! It work!!
    Thanks!!

    But i've used this sintax for "cancel" the record:
    Code:
        rowEditing2.on('canceledit', function(me) {
              //me.context.record.store.remove(me.context.record);    
            store.load();
        });
    because if i stay updating a record and press "cancel", this sistem didn't hide the record; while "me.context.record.store.remove(me.context.record)" hide the exists record and "cancel" the new record that was not save.

    Thank You!!!!

  4. #14
    Sencha User
    Join Date
    Mar 2011
    Posts
    208
    Vote Rating
    0
    bee is on a distinguished road

      0  

    Default


    Thanks Guys.. you saved my day..!!