Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1085
Cancelling editCellEnding event loses cell focus
posted

When in cell edit mode, if we hook the editCellEnding event and cancel it due to invalid information and set the keepEditing flag to true, the invalid cell's contents can end up displayed over the top of the next cell if the user left the invalid cell by tabbing.

We have tracked this issue down to the premature removal of the edit class in infragistics.ui.grid.updating.js, method _endEdit.

In this method, the editingCell css is removed as soon as the validators are checked, but this action does not take into account the fact the the editCellEnding event may be cancelled.

The solution is to only remove the class after editCellEnding has successfully completed:

                    // cell editing
                    if (!vals) {
                        if (e && oldUpdate && !_filter(editor, 'validate')) {
                            if (!stop) {
                                _stop(stop = e);
                            }
                            // scroll to and set focus to editor
                            this._scrollTo(td, editor, 1);
                            return 1;
                        }
                        // Don't remove the class until we are sure editCellEnding succeeds
                        //td.removeClass(this.css.editingCell);
                    }
                    // prevent double processing of same event (user showed alert!)
                    this._skip = 1;
                    // 1-hide buttons
                    this._doButtons(1);
                    val = _filter(editor, 'getValue');
                    arg = this._evtArg(td, editor, val);
                    arg.update = !!update;
                    arg.oldValue = editor._oldCellVal;
                    if (!vals) {
                        arg.keepEditing = false;
                    }
                    if (!this._fire('editCellEnding', eArg, arg)) {
                        arg.value = editor._oldCellVal;
                    }
                    if (oldUpdate && !vals && e && arg.keepEditing) {
                        _stop(e);
                        // scroll to and set focus to editor
                        this._scrollTo(td, editor, 1);
                        delete this._skip;
                        return 1;
                    }
                    // Added next 3 to support cancellation and continued editing of cell when editCellEnding fails.
                    if (!vals) {
                        td.removeClass(this.css.editingCell);
                    }
Parents
  • 29417
    Offline posted

    Hello Karl ,

     

    Thank you for posting in our forum.

     

    Could you let me know which version of our controls you’re currently using?

    I’ve tested this with version 13.1: 13.1.20131.2039 and I was not able to reproduce this.

    If it’s browser specific please let me know which browser it reproduces in and its exact version.

    I’m also attaching the sample I used to test this. Let me know if I’m missing anything from your scenario.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer II

    Infragistics, Inc.

    http://ko.infragistics.com/support

     

    editCellEnding.zip
Reply Children
No Data