Ticket #6730 (new enhancement)

Opened 5 days ago

Last modified 5 days ago

Add extension point to Grid editing to intercept edits

Reported by: freelock Owned by: sorvell
Priority: normal Milestone:
Component: DojoX Grid Version: 1.1.0
Severity: normal Keywords:
Cc: john@…

Description (last modified by freelock) (diff)

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

Changed 5 days ago by freelock

  • description modified (diff)

Corrected module definition for Bool.

Note: See TracTickets for help on using tickets.