Jason Swett
Jason Swett

Reputation: 45164

How can I observe the event of a DataGrid's cell being edited?

If you take one of your DataGrid columns and set editable to true it lets you edit that cell. That's great, but what if I want to send an ajax request after the cell gets edited? How can I observe the event?

I'm on Dojo 1.5 if it matters.

Upvotes: 1

Views: 4695

Answers (1)

DanneManne
DanneManne

Reputation: 21180

If you want to examine the Events for a DataGrid then I would recommend checking dojox.grid._Events. That object contains a lot of events that is included in DataGrid.

Here is a list of a few Events that might suite your need:

// editing
onStartEdit: function(inCell, inRowIndex){
    // summary:
    //      Event fired when editing is started for a given grid cell
    // inCell: Object
    //      Cell object containing properties of the grid column.
    // inRowIndex: Integer
    //      Index of the grid row
},

onApplyCellEdit: function(inValue, inRowIndex, inFieldIndex){
    // summary:
    //      Event fired when editing is applied for a given grid cell
    // inValue: String
    //      Value from cell editor
    // inRowIndex: Integer
    //      Index of the grid row
    // inFieldIndex: Integer
    //      Index in the grid's data store
},

onCancelEdit: function(inRowIndex){
    // summary:
    //      Event fired when editing is cancelled for a given grid cell
    // inRowIndex: Integer
    //      Index of the grid row
},

onApplyEdit: function(inRowIndex){
    // summary:
    //      Event fired when editing is applied for a given grid row
    // inRowIndex: Integer
    //      Index of the grid row
}

Upvotes: 4

Related Questions