13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='Ext-grid-plugin-Editing'>/**
</span> * This class provides an abstract grid editing plugin on selected {@link Ext.grid.column.Column columns}.
 * The editable columns are specified by providing an {@link Ext.grid.column.Column#editor editor}
 * in the {@link Ext.grid.column.Column column configuration}.
 *
 * **Note:** This class should not be used directly. See {@link Ext.grid.plugin.CellEditing} and
 * {@link Ext.grid.plugin.RowEditing}.
 */
Ext.define('Ext.grid.plugin.Editing', {
    alias: 'editing.editing',
    extend: 'Ext.AbstractPlugin',
 
    requires: [
        'Ext.grid.column.Column',
        'Ext.util.KeyNav'
    ],
 
    mixins: {
        observable: 'Ext.util.Observable'
    },
 
<span id='Ext-grid-plugin-Editing-cfg-clicksToEdit'>    /**
</span>     * @cfg {Number} clicksToEdit
     * The number of clicks on a grid required to display the editor.
     * The only accepted values are **1** and **2**.
     */
    clicksToEdit: 2,
 
<span id='Ext-grid-plugin-Editing-cfg-triggerEvent'>    /**
</span>     * @cfg {String} triggerEvent
     * The event which triggers editing. Supercedes the {@link #clicksToEdit} configuration. Maybe one of:
     *
     *  * cellclick
     *  * celldblclick
     *  * cellfocus
     *  * rowfocus
     */
    triggerEvent: undefined,
 
<span id='Ext-grid-plugin-Editing-property-relayedEvents'>    relayedEvents: [
</span>        'beforeedit',
        'edit',
        'validateedit',
        'canceledit'
    ],
 
<span id='Ext-grid-plugin-Editing-property-defaultFieldXType'>    // @private
</span>    defaultFieldXType: 'textfield',
 
<span id='Ext-grid-plugin-Editing-property-editStyle'>    // cell, row, form
</span>    editStyle: '',
 
<span id='Ext-grid-plugin-Editing-method-constructor'>    constructor: function(config) {
</span>        var me = this;
 
        me.addEvents(
<span id='Ext-grid-plugin-Editing-event-beforeedit'>            /**
</span>             * @event beforeedit
             * Fires before editing is triggered. Return false from event handler to stop the editing.
             *
             * @param {Ext.grid.plugin.Editing} editor
             * @param {Object} context The editing context with the following properties:
             *  @param {Ext.grid.Panel}         context.grid The owning grid Panel.
             *  @param {Ext.data.Model}         context.record The record being edited.
             *  @param {String}                 context.field The name of the field being edited.
             *  @param {Mixed}                  context.value The field's current value.
             *  @param {HTMLElement}            context.row The grid row element.
             *  @param {Ext.grid.column.Column} context.column The Column being edited.
             *  @param {Number}                 context.rowIdx The index of the row being edited.
             *  @param {Number}                 context.colIdx The index of the column being edited.
             *  @param {Boolean}                context.cancel Set this to `true` to cancel the edit or return false from your handler.
             *  @param {Mixed}                  context.originalValue Alias for value (only when using {@link Ext.grid.plugin.CellEditing CellEditing}).
             */
            'beforeedit',
 
<span id='Ext-grid-plugin-Editing-event-edit'>            /**
</span>             * @event edit
             * Fires after a editing. Usage example:
             *
             *     grid.on('edit', function(editor, e) {
             *         // commit the changes right after editing finished
             *         e.record.commit();
             *     });
             *
             * @param {Ext.grid.plugin.Editing} editor
             * @param {Object} context The editing context with the following properties:
             *  @param {Ext.grid.Panel}         context.grid The owning grid Panel.
             *  @param {Ext.data.Model}         context.record The record being edited.
             *  @param {String}                 context.field The name of the field being edited.
             *  @param {Mixed}                  context.value The field's current value.
             *  @param {HTMLElement}            context.row The grid row element.
             *  @param {Ext.grid.column.Column} context.column The Column being edited.
             *  @param {Number}                 context.rowIdx The index of the row being edited.
             *  @param {Number}                 context.colIdx The index of the column being edited.
             */
            'edit',
 
<span id='Ext-grid-plugin-Editing-event-validateedit'>            /**
</span>             * @event validateedit
             * Fires after editing, but before the value is set in the record. Return false from event handler to
             * cancel the change.
             *
             * Usage example showing how to remove the red triangle (dirty record indicator) from some records (not all). By
             * observing the grid's validateedit event, it can be cancelled if the edit occurs on a targeted row (for example)
             * and then setting the field's new value in the Record directly:
             *
             *     grid.on('validateedit', function(editor, e) {
             *       var myTargetRow = 6;
             *
             *       if (e.rowIdx == myTargetRow) {
             *         e.cancel = true;
             *         e.record.data[e.field] = e.value;
             *       }
             *     });
             *
             * @param {Ext.grid.plugin.Editing} editor
             * @param {Object} context The editing context with the following properties:
             *  @param {Ext.grid.Panel}         context.grid The owning grid Panel.
             *  @param {Ext.data.Model}         context.record The record being edited.
             *  @param {String}                 context.field The name of the field being edited.
             *  @param {Mixed}                  context.value The field's current value.
             *  @param {HTMLElement}            context.row The grid row element.
             *  @param {Ext.grid.column.Column} context.column The Column being edited.
             *  @param {Number}                 context.rowIdx The index of the row being edited.
             *  @param {Number}                 context.colIdx The index of the column being edited.
             */
            'validateedit',
<span id='Ext-grid-plugin-Editing-event-canceledit'>            /**
</span>             * @event canceledit
             * Fires when the user started editing but then cancelled the edit.
             * @param {Ext.grid.plugin.Editing} editor
             * @param {Object} context The editing context with the following properties:
             *  @param {Ext.grid.Panel}         context.grid The owning grid Panel.
             *  @param {Ext.data.Model}         context.record The record being edited.
             *  @param {String}                 context.field The name of the field being edited.
             *  @param {Mixed}                  context.value The field's current value.
             *  @param {HTMLElement}            context.row The grid row element.
             *  @param {Ext.grid.column.Column} context.column The Column being edited.
             *  @param {Number}                 context.rowIdx The index of the row being edited.
             *  @param {Number}                 context.colIdx The index of the column being edited.
             */
            'canceledit'
 
        );
        me.callParent(arguments);
        me.mixins.observable.constructor.call(me);
        // TODO: Deprecated, remove in 5.0
        me.on(&quot;edit&quot;, function(editor, e) {
            me.fireEvent(&quot;afteredit&quot;, editor, e);
        });
    },
 
<span id='Ext-grid-plugin-Editing-method-init'>    // @private
</span>    init: function(grid) {
        var me = this;
 
        me.grid = grid;
        me.view = grid.view;
        me.initEvents();
 
        // Set up fields at render and reconfigure time
        me.mon(grid, {
            reconfigure: me.onReconfigure,
            scope: me,
            beforerender: {
                fn: me.onReconfigure,
                single: true,
                scope: me
            }
        });
 
        grid.relayEvents(me, me.relayedEvents);
 
        // If the editable grid is owned by a lockable, relay up another level.
        if (me.grid.ownerLockable) {
            me.grid.ownerLockable.relayEvents(me, me.relayedEvents);
        }
        // Marks the grid as editable, so that the SelectionModel
        // can make appropriate decisions during navigation
        grid.isEditable = true;
        grid.editingPlugin = grid.view.editingPlugin = me;
    },
 
<span id='Ext-grid-plugin-Editing-method-onReconfigure'>    /**
</span>     * Fires after the grid is reconfigured
     * @private
     */
    onReconfigure: function() {
        var grid = this.grid;
 
        // In a Lockable assembly, the owner's view aggregates all grid columns across both sides.
        // We grab all columns here.
        grid = grid.ownerLockable ? grid.ownerLockable : grid;
        this.initFieldAccessors(grid.getView().getGridColumns());
    },
 
<span id='Ext-grid-plugin-Editing-method-destroy'>    /**
</span>     * @private
     * AbstractComponent calls destroy on all its plugins at destroy time.
     */
    destroy: function() {
        var me = this,
            grid = me.grid;
 
        Ext.destroy(me.keyNav);
        // Clear all listeners from all our events, clear all managed listeners we added to other Observables
        me.clearListeners();
 
        if (grid) {
            me.removeFieldAccessors(grid.columnManager.getColumns());
            grid.editingPlugin = grid.view.editingPlugin = me.grid = me.view = me.editor = me.keyNav = null;
        }
    },
 
<span id='Ext-grid-plugin-Editing-method-getEditStyle'>    // @private
</span>    getEditStyle: function() {
        return this.editStyle;
    },
 
<span id='Ext-grid-plugin-Editing-method-initFieldAccessors'>    // @private
</span>    initFieldAccessors: function(columns) {
        // If we have been passed a group header, process its leaf headers
        if (columns.isGroupHeader) {
            columns = columns.getGridColumns();
        }
 
        // Ensure we are processing an array
        else if (!Ext.isArray(columns)) {
            columns = [columns];
        }
 
        var me   = this,
            c,
            cLen = columns.length,
            column;
 
        for (c = 0; c &lt; cLen; c++) {
            column = columns[c];
 
            if (!column.getEditor) {
                column.getEditor = function(record, defaultField) {
                    return me.getColumnField(this, defaultField);
                };
            }
            if (!column.hasEditor) {
                column.hasEditor = function() {
                    return me.hasColumnField(this);
                };
            }
            if (!column.setEditor) {
                column.setEditor = function(field) {
                    me.setColumnField(this, field);
                };
            }
        }
    },
 
<span id='Ext-grid-plugin-Editing-method-removeFieldAccessors'>    // @private
</span>    removeFieldAccessors: function(columns) {
        // If we have been passed a group header, process its leaf headers
        if (columns.isGroupHeader) {
            columns = columns.getGridColumns();
        }
 
        // Ensure we are processing an array
        else if (!Ext.isArray(columns)) {
            columns = [columns];
        }
 
        var c,
            cLen = columns.length,
            column;
 
        for (c = 0; c &lt; cLen; c++) {
            column = columns[c];
 
            column.getEditor = column.hasEditor = column.setEditor = null;
        }
    },
 
<span id='Ext-grid-plugin-Editing-method-getColumnField'>    // @private
</span>    // remaps to the public API of Ext.grid.column.Column.getEditor
    getColumnField: function(columnHeader, defaultField) {
        var field = columnHeader.field;
        if (!(field &amp;&amp; field.isFormField)) {
            field = columnHeader.field = this.createColumnField(columnHeader, defaultField);
        }
        return field;
    },
 
<span id='Ext-grid-plugin-Editing-method-hasColumnField'>    // @private
</span>    // remaps to the public API of Ext.grid.column.Column.hasEditor
    hasColumnField: function(columnHeader) {
        return !!columnHeader.field;
    },
 
<span id='Ext-grid-plugin-Editing-method-setColumnField'>    // @private
</span>    // remaps to the public API of Ext.grid.column.Column.setEditor
    setColumnField: function(columnHeader, field) {
        columnHeader.field = field;
        columnHeader.field = this.createColumnField(columnHeader);
    },
 
<span id='Ext-grid-plugin-Editing-method-createColumnField'>    createColumnField:  function(columnHeader, defaultField) {
</span>        var field = columnHeader.field;
 
        if (!field &amp;&amp; columnHeader.editor) {
            field = columnHeader.editor;
            columnHeader.editor = null;
        }
 
        if (!field &amp;&amp; defaultField) {
            field = defaultField;
        }
 
        if (field) {
            if (field.isFormField) {
                field.column = columnHeader;
            } else {
                if (Ext.isString(field)) {
                    field = {
                        name: columnHeader.dataIndex,
                        xtype: field,
                        column: columnHeader
                    };
                } else {
                    field = Ext.apply({
                        name: columnHeader.dataIndex,
                        column: columnHeader
                    }, field);
                }
                field = Ext.ComponentManager.create(field, this.defaultFieldXType);
            }
            columnHeader.field = field;
        }
        return field;
    },
 
<span id='Ext-grid-plugin-Editing-method-initEvents'>    // @private
</span>    initEvents: function() {
        var me = this;
        me.initEditTriggers();
        me.initCancelTriggers();
    },
 
<span id='Ext-grid-plugin-Editing-method-initCancelTriggers'>    // @abstract
</span>    initCancelTriggers: Ext.emptyFn,
 
<span id='Ext-grid-plugin-Editing-method-initEditTriggers'>    // @private
</span>    initEditTriggers: function() {
        var me = this,
            view = me.view;
 
        // Listen for the edit trigger event.
        if (me.triggerEvent == 'cellfocus') {
            me.mon(view, 'cellfocus', me.onCellFocus, me);
        } else if (me.triggerEvent == 'rowfocus') {
            me.mon(view, 'rowfocus', me.onRowFocus, me);
        } else {
 
            // Prevent the View from processing when the SelectionModel focuses.
            // This is because the SelectionModel processes the mousedown event, and
            // focusing causes a scroll which means that the subsequent mouseup might
            // take place at a different document XY position, and will therefore
            // not trigger a click.
            // This Editor must call the View's focusCell method directly when we recieve a request to edit
            if (view.getSelectionModel().isCellModel) {
                view.onCellFocus = Ext.Function.bind(me.beforeViewCellFocus, me);
            }
 
            // Listen for whichever click event we are configured to use
            me.mon(view, me.triggerEvent || ('cell' + (me.clicksToEdit === 1 ? 'click' : 'dblclick')), me.onCellClick, me);
        }
 
        // add/remove header event listeners need to be added immediately because
        // columns can be added/removed before render
        me.initAddRemoveHeaderEvents()
        // wait until render to initialize keynav events since they are attached to an element
        view.on('render', me.initKeyNavHeaderEvents, me, {single: true});
    },
 
<span id='Ext-grid-plugin-Editing-method-beforeViewCellFocus'>    // Override of View's method so that we can pre-empt the View's processing if the view is being triggered by a mousedown
</span>    beforeViewCellFocus: function(position) {
        // Pass call on to view if the navigation is from the keyboard, or we are not going to edit this cell.
        if (this.view.selModel.keyNavigation || !this.editing || !this.isCellEditable || !this.isCellEditable(position.row, position.columnHeader)) {
            this.view.focusCell.apply(this.view, arguments);
        }
    },
 
<span id='Ext-grid-plugin-Editing-method-onRowFocus'>    // @private Used if we are triggered by the rowfocus event
</span>    onRowFocus: function(record, row, rowIdx) {
        this.startEdit(row, 0);
    },
 
<span id='Ext-grid-plugin-Editing-method-onCellFocus'>    // @private Used if we are triggered by the cellfocus event
</span>    onCellFocus: function(record, cell, position) {
        this.startEdit(position.row, position.column);
    },
 
<span id='Ext-grid-plugin-Editing-method-onCellClick'>    // @private Used if we are triggered by a cellclick event
</span>    onCellClick: function(view, cell, colIdx, record, row, rowIdx, e) {
        // cancel editing if the element that was clicked was a tree expander
        if(!view.expanderSelector || !e.getTarget(view.expanderSelector)) {
            this.startEdit(record, view.ownerCt.columnManager.getHeaderAtIndex(colIdx));
        }
    },
 
<span id='Ext-grid-plugin-Editing-method-initAddRemoveHeaderEvents'>    initAddRemoveHeaderEvents: function(){
</span>        var me = this;
        me.mon(me.grid.headerCt, {
            scope: me,
            add: me.onColumnAdd,
            remove: me.onColumnRemove,
            columnmove: me.onColumnMove
        });
    },
 
<span id='Ext-grid-plugin-Editing-method-initKeyNavHeaderEvents'>    initKeyNavHeaderEvents: function() {
</span>        var me = this;
 
        me.keyNav = Ext.create('Ext.util.KeyNav', me.view.el, {
            enter: me.onEnterKey,
            esc: me.onEscKey,
            scope: me
        });
    },
 
<span id='Ext-grid-plugin-Editing-method-onColumnAdd'>    // @private
</span>    onColumnAdd: function(ct, column) {
        this.initFieldAccessors(column);
    },
 
<span id='Ext-grid-plugin-Editing-method-onColumnRemove'>    // @private
</span>    onColumnRemove: function(ct, column) {
        this.removeFieldAccessors(column);
    },
 
<span id='Ext-grid-plugin-Editing-method-onColumnMove'>    // @private
</span>    // Inject field accessors on move because if the move FROM the main headerCt and INTO a grouped header,
    // the accessors will have been deleted but not added. They are added conditionally.
    onColumnMove: function(headerCt, column, fromIdx, toIdx) {
        this.initFieldAccessors(column);
    },
 
<span id='Ext-grid-plugin-Editing-method-onEnterKey'>    // @private
</span>    onEnterKey: function(e) {
        var me = this,
            grid = me.grid,
            selModel = grid.getSelectionModel(),
            record,
            pos,
            columnHeader;
 
        // Calculate editing start position from SelectionModel if there is a selection
        // Note that the condition below tests the result of an assignment to the &quot;pos&quot; variable.
        if (selModel.getCurrentPosition &amp;&amp; (pos = selModel.getCurrentPosition())) {
            record = pos.record;
            columnHeader = pos.columnHeader;
        }
        // RowSelectionModel
        else {
            record = selModel.getLastSelected();
            columnHeader = grid.columnManager.getHeaderAtIndex(0);
        }
 
        // If there was a selection to provide a starting context...
        if (record &amp;&amp; columnHeader) {
            me.startEdit(record, columnHeader);
        }
    },
 
<span id='Ext-grid-plugin-Editing-method-onEscKey'>    // @private
</span>    onEscKey: function(e) {
        return this.cancelEdit();
    },
 
<span id='Ext-grid-plugin-Editing-method-beforeEdit'>    /**
</span>     * @private
     * @template
     * Template method called before editing begins.
     * @param {Object} context The current editing context
     * @return {Boolean} Return false to cancel the editing process
     */
    beforeEdit: Ext.emptyFn,
 
<span id='Ext-grid-plugin-Editing-method-startEdit'>    /**
</span>     * Starts editing the specified record, using the specified Column definition to define which field is being edited.
     * @param {Ext.data.Model/Number} record The Store data record which backs the row to be edited, or index of the record in Store.
     * @param {Ext.grid.column.Column/Number} columnHeader The Column object defining the column to be edited, or index of the column.
     */
    startEdit: function(record, columnHeader) {
        var me = this,
            context,
            layoutView = me.grid.lockable ? me.grid : me.view;
 
        // The view must have had a layout to show the editor correctly, defer until that time.
        // In case a grid's startup code invokes editing immediately.
        if (!layoutView.componentLayoutCounter) {
            layoutView.on({
                boxready: Ext.Function.bind(me.startEdit, me, [record, columnHeader]),
                single: true
            });
            return false;
        }
 
        // If grid collapsed, or view not truly visible, don't even calculate a context - we cannot edit
        if (me.grid.collapsed || !me.grid.view.isVisible(true)) {
            return false;
        }
 
        context = me.getEditingContext(record, columnHeader);
        if (context == null) {
            return false;
        }
        if (!me.preventBeforeCheck) {
            if (me.beforeEdit(context) === false || me.fireEvent('beforeedit', me, context) === false || context.cancel) {
                return false;
            }
        }
 
<span id='Ext-grid-plugin-Editing-property-editing'>        /**
</span>         * @property {Boolean} editing
         * Set to `true` while the editing plugin is active and an Editor is visible.
         */
        me.editing = true;
        return context;
    },
 
    // TODO: Have this use a new class Ext.grid.CellContext for use here, and in CellSelectionModel
<span id='Ext-grid-plugin-Editing-method-getEditingContext'>    /**
</span>     * @private
     * Collects all information necessary for any subclasses to perform their editing functions.
     * @param record
     * @param columnHeader
     * @returns {Object/undefined} The editing context based upon the passed record and column
     */
    getEditingContext: function(record, columnHeader) {
        var me = this,
            grid = me.grid,
            view = me.view,
            gridRow = view.getNode(record, true),
            rowIdx, colIdx;
 
        // An intervening listener may have deleted the Record
        if (!gridRow) {
            return;
        }
 
        // Coerce the column index to the closest visible column
        columnHeader = grid.columnManager.getVisibleHeaderClosestToIndex(Ext.isNumber(columnHeader) ? columnHeader : columnHeader.getVisibleIndex());
 
        // No corresponding column. Possible if all columns have been moved to the other side of a lockable grid pair
        if (!columnHeader) {
            return;
        }
 
        colIdx = columnHeader.getVisibleIndex();
 
        if (Ext.isNumber(record)) {
            // look up record if numeric row index was passed
            rowIdx = record;
            record = view.getRecord(gridRow);
        } else {
            rowIdx = view.indexOf(gridRow);
        }
 
        // The record may be removed from the store but the view
        // not yet updated, so check it exists
        if (!record) {
            return;
        }
 
        return {
            grid   : grid,
            view   : view,
            store  : view.dataSource,
            record : record,
            field  : columnHeader.dataIndex,
            value  : record.get(columnHeader.dataIndex),
            row    : gridRow,
            column : columnHeader,
            rowIdx : rowIdx,
            colIdx : colIdx
        };
    },
 
<span id='Ext-grid-plugin-Editing-method-cancelEdit'>    /**
</span>     * Cancels any active edit that is in progress.
     */
    cancelEdit: function() {
        var me = this;
 
        me.editing = false;
        me.fireEvent('canceledit', me, me.context);
    },
 
<span id='Ext-grid-plugin-Editing-method-completeEdit'>    /**
</span>     * Completes the edit if there is an active edit in progress.
     */
    completeEdit: function() {
        var me = this;
 
        if (me.editing &amp;&amp; me.validateEdit()) {
            me.fireEvent('edit', me, me.context);
        }
 
        me.context = null;
        me.editing = false;
    },
 
<span id='Ext-grid-plugin-Editing-method-validateEdit'>    // @abstract
</span>    validateEdit: function() {
        var me = this,
            context = me.context;
 
        return me.fireEvent('validateedit', me, context) !== false &amp;&amp; !context.cancel;
    }
});
</pre>
</body>
</html>