PDA

View Full Version : [DEFER-763][2.x/3.x] clicksToEdit:1 requires double click for same row



gegene421
3 Nov 2008, 9:42 AM
Hi everybody

The clicksToEdit:1 is still not working as well I hope :

if you take this example :

http://extjs.com/deploy/dev/examples...edit-grid.html (http://extjs.com/deploy/dev/examples/grid/edit-grid.html)

Here is my problem

1) click on "blue gentian" - don't change the cell
2) then click on "sun or shade", the right cell of "blue gentian" - >you are in edit mode

1) click on "blue gentian" - change the cell
2) then click on "sun or shade", the right cell of "blue gentian" - >you are in NOT edit mode

1) click on "blue gentian" - change the cell
2) then click on "Anenome", (first col 2nd row) - >you are in edit mode

So the problem is only when you click on the next right cell, you have edit before :(

Thanks to look at this problem

gegene421
6 Nov 2008, 8:13 AM
up :s

Condor
21 Jan 2009, 11:25 PM
This is an annoying one. The mousedown event will trigger a blur event in the first editor, which will complete the edit and update the row.
Updating the row will remove the current row and add a new one. This, however, will kill the click event that should follow the mousedown event (the original target element no longer exists).

The easiest solution is probably to start editing in the mousedown event:

Ext.override(Ext.grid.EditorGridPanel, {
initEvents : function(){
Ext.grid.EditorGridPanel.superclass.initEvents.call(this);
this.on("bodyscroll", this.stopEditing, this, [true]);
this.on("columnresize", this.stopEditing, this, [true]);
if(this.clicksToEdit == 'mousedown'){
this.view.scroller.on("mousedown", this.onMouseDownEditClick, this);
}else
if(this.clicksToEdit == 1){
this.on("cellclick", this.onCellDblClick, this);
}else {
if(this.clicksToEdit == 'auto' && this.view.mainBody){
this.view.mainBody.on("mousedown", this.onAutoEditClick, this);
}
this.on("celldblclick", this.onCellDblClick, this);
}
},
onMouseDownEditClick : function(e, t){
if(e.button !== 0){
return;
}
var row = this.view.findRowIndex(t);
var col = this.view.findCellIndex(t);
if(row !== false && col !== false){
this.startEditing(row, col);
}
}
});

After including the patch you can use clicksToEdit:'mousedown' to fix the problem (but row drag&drop will no longer work correctly, because it also uses the mousedown event).

janapol
22 Jan 2009, 5:01 PM
Looks great, thanks!

wp.joju
12 May 2009, 2:20 AM
editing the grid content (using the editor), in case of the online sample, double clicking the "light" column will make the grid width wider, any fix on this?

Condor
12 May 2009, 2:27 AM
That's a completely different bug (http://extjs.com/forum/showthread.php?p=282928#post282928).

Condor
22 Mar 2010, 4:28 AM
This problem is still present in Ext 3.1 (see post (http://www.extjs.com/forum/showthread.php?t=94851)).

This problem is closely related to #82 (http://www.extjs.com/forum/showthread.php?t=62466).