Reputation: 603
I'm using a dojox.grid.EnhancedGrid
that has an editable cell. The SPACEBAR triggers the edit mode (which is an ok-ish approach, I guess). However, if I trigger the edit mode programatically (via a link in an adjacent cell) or by double-click and I start typing some text like "This value is good", as soon as I hit the SPACEBAR (after "This") the grid tries to trigger the edit again and it deletes what I've entered so far.
Does anybody know how to fix this? It's really annoying because it happens only when using other means of entering the cell in edit mode other than onKeyDown
event (i.e. if I focus the cell and press ENTER the cell goes into edit mode and spaces are allowed; if I double-click the cell and enter edit mode the first time I press SPACEBAR the edit mode messes up).
Thank your for your answers.
Upvotes: 0
Views: 394
Reputation: 21
Seems that I was able to solve this issue. this post helps me: Dynamically control edit mode of dojo DataGrid column
and here is a final solution:
var customOnEditActivate = function(e){
var event;
if(this._click.length > 1 && has('ie')){
event = this._click[1];
}else if(this._click.length > 1 && this._click[0].rowIndex != this._click[1].rowIndex){
event = this._click[0];
}else{
event = e;
}
this.focus.setFocusCell(event.cell, event.rowIndex);
this.onRowClick(event);
this.edit.setEditCell(event.cell, event.rowIndex);
this.onRowDblClick(e);
};
wordsGrid = new dojox.grid.EnhancedGrid({
query : ...,
store : ...,
singleClickEdit: false,
selectionMode:"single",
....
}, container);
dojo.connect(wordsGrid, "onCellDblClick", customOnEditActivate);
so the edit event is fired even without connecting to onCellDblClick. But seems that code inside customOnEditActivate does some magic with grid properties and fixes this issue. If anyone has some other solution - please share it!
Upvotes: 0
Reputation: 21
I have the same issue. But I realized that in my case issue is valid only if singleClickEdit property is set to false. Other words if singleClickEdit:true - it is possible to enter space to the editable field
Upvotes: 2