Opened 12 years ago

Last modified 8 years ago

#6730 closed enhancement

Add extension point to Grid editing to intercept edits — at Version 1

Reported by: John Locke Owned by: sorvell
Priority: high Milestone: future
Component: DojoX Grid Version: 1.1.0
Keywords: Cc: [email protected]
Blocked By: Blocking:

Description (last modified by John Locke)

When hooking a grid up to a DojoData? store, you can have columns that do not correspond to data fields. While you can set the values of these columns using get and/or formatter functions, you can't do anything to capture the results of editing.

Specifically, capturing a change of a checkbox (dojox.grid.editors.Bool) is not possible from the grid definition.

For this specific editor, changing the dojox.grid.editors.AlwaysOn? definition to call the cell.applyEdit instead of the grid.edit.applyCellEdit allows you to override cell.applyEdit (which calls grid.edit.applyCellEdit) provides for a nice extension point. With this change, I can provide an "applyEdit" parameter in the view, and capture the change in the checkbox without it going back to the model.

Proposed change:

$ svn diff dojox/grid/_data/
Index: dojox/grid/_data/editors.js
===================================================================
--- dojox/grid/_data/editors.js (revision 13680)
+++ dojox/grid/_data/editors.js (working copy)
@@ -212,9 +212,9 @@
                this.formatNode(this.getNode(inRowIndex), inDatum, inRowIndex);
        },
        applyStaticValue: function(inRowIndex){
-               var e = this.cell.grid.edit;
-               e.applyCellEdit(this.getValue(inRowIndex), this.cell, inRowIndex);
-               e.start(this.cell, inRowIndex, true);
+               var c = this.cell;
+               c.applyEdit(this.getValue(inRowIndex),inRowIndex);
+               c.grid.edit.start(this.cell, inRowIndex, true);
        }
 });

Change History (1)

comment:1 Changed 12 years ago by John Locke

Description: modified (diff)

Corrected module definition for Bool.

Note: See TracTickets for help on using tickets.