Results 1 to 7 of 7

Thread: [4.1.0] Row editing plugin doesn't fire "canceledit" when changing row

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User Fire-Dragon-DoL's Avatar
    Join Date
    Dec 2011
    Posts
    141
    Vote Rating
    1
      0  

    Default [4.1.0] Row editing plugin doesn't fire "canceledit" when changing row

    Referencing this topic for this bug: http://www.sencha.com/forum/showthre...691#post811691

    If autoCancel is set to true, and we move the editor on a different row, the changes are actually canceled but "canceledit" event is not fired.

    I think that if any changes are reverted (in any moment), canceledit should be fired. In this situation should be fired too.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,416
    Vote Rating
    1270
      0  

    Default

    The event is only fired when you press the cancel button.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Aug 2014
    Posts
    10
    Vote Rating
    0
      0  

    Default

    Not to necro this thread, but why is it considered ok to have an important event (moving row editor to a new record) not fire any event? It gives us no way to handle the very common scenario where we may want to remove the newly added record from the store if they cancel without entering all valid information.

    Edit: This is still an issue in Ext 5 btw

  4. #4
    Sencha User Fire-Dragon-DoL's Avatar
    Join Date
    Dec 2011
    Posts
    141
    Vote Rating
    1
      0  

    Default

    Quote Originally Posted by andersonjohnf View Post
    Not to necro this thread, but why is it considered ok to have an important event (moving row editor to a new record) not fire any event? It gives us no way to handle the very common scenario where we may want to remove the newly added record from the store if they cancel without entering all valid information.

    Edit: This is still an issue in Ext 5 btw
    I agree with you, I ended dropping Ext, faced various similar issues

  5. #5
    Sencha User
    Join Date
    Aug 2014
    Posts
    10
    Vote Rating
    0
      0  

    Default

    Code:
    Ext.define('MyApp.patch.Editing', {
        override: 'Ext.grid.plugin.Editing',
        onCellClick: function(view, cell, colIdx, record, row, rowIdx, e) {
            if (this.editing) return; // kill moveByClick
            
            var expanderSelector = view.expanderSelector,
                columnHeader = view.ownerCt.getColumnManager().getHeaderAtIndex(colIdx),
                editor = columnHeader.getEditor(record);
    
    
            if (this.shouldStartEdit(editor) && (!expanderSelector || !e.getTarget(expanderSelector))) {
                this.startEdit(record, columnHeader);
            }
        }
    });
    I ended up just doing an override that kills move by click in a roweditor when you are currently editing. In our application there isn't a reason for someone to be able to bounce between rows without finishing the one they're on. I'm pretty surprised that this isn't a config option.

    Edit: That override is for ExtJS 5.0.1 btw

  6. #6
    Sencha Premium User
    Join Date
    Jan 2014
    Location
    Fort Worth, TX, USA
    Posts
    59
    Vote Rating
    5
      0  

    Default

    Any news on this? It's still present in 6.0.1. @andersonjohnf your override works almost perfectly, but you can still tab and arrow key to the other rows and start them editing. It doesn't seem to work with manually calling the cancel method when beforeedit is fired either.

  7. #7
    Sencha User
    Join Date
    Jun 2016
    Posts
    1
    Vote Rating
    0
      0  

    Default

    I bumped into this issue in ExtJS 6.x as well, so I updated the overrides posted before for 6.x:


    Code:
    Ext.define("MyApp.grid.plugin.RowEditing", {
      requires: ["Ext.grid.plugin.RowEditing"],
      override: "Ext.grid.plugin.RowEditing",
    
    
      confirmCancelMsg: "",
    
    
      moveEditorByClick: function () {
        var me = this;
        if (me.editing) {
          var args = arguments;
          me.getContextFieldValues();
          if (me.autoCancel || Ext.Object.equals(me.context.originalValues, me.context.newValues)) {
            me._moveEditor(me, args);
          } else {
            Ext.Msg.confirm("", me.confirmCancelMsg, function (btn) {
              if (btn == "yes") {
                me._moveEditor(me, args);
              }
            });
          }
        }
      },
    
      _moveEditor: function (me, args) {
        me.fireEvent("moveeditor", me, me.context);
        me.superclass.onCellClick.apply(me, args);
      }
    });


    This checks if autoCancel is on, if it's not it checks if you've already entered any new data in the current editor, and if you have it asks you if you want to cancel those changes or not. If you don't cancel, the editor stays.


    In all other cases, it moves the editor after firing a new 'moveeditor' event which you can treat the same as the existing 'canceledit' event (or differently, if you prefer).

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •