PDA

View Full Version : [OPEN-509]cellclick event does not fire when cell must be scrolled into view



willryanuk
31 Dec 2009, 8:36 AM
This relates to a bug that has persisted from 2.1 (initially reported here (http://www.extjs.com/forum/showthread.php?t=32046)).

When you click on a grid cell that needs to be scrolled into view (i.e. a partially obscured cell), neither the cellclick nor rowclick event propagate, although the cell is highlighted.

From my testing, the bug is apparent on FF 3.5.6, Safari 3.1 and Chrome 3.0. It is not a problem in IE8 or IE6.

evant
28 Jan 2010, 3:14 PM
I wasn't able to reproduce this. I took the array grid example and modified some of the column widths.

I then clicked on the rightmost cells, both in the first and second rows (with the scroll position as shown in the screen grab). You can see the events are fired. Do you have a better test case I can use?

willryanuk
29 Jan 2010, 5:42 AM
It occurs when a grid row is partially hidden in the vertical direction within its container as opposed to hidden in the horizontal direction. When you click on a row that is vertically hidden, the container scrolls down to reveal that entire row, but the the events don't fire. If you cannot replicate this behaviour then I'll mock up some code.

Thanks.

evant
31 Jan 2010, 3:14 PM
I can see it happening, the problem is that the mousedown event gets fired, but the click event (even the raw one) never gets fired. Perhaps it's because the row moves into view on the mousedown which somehow screws up the click.

willryanuk
1 Feb 2010, 2:11 AM
Can we raise this as a bug and get it fixed in the next patch release? It is important for my project that we can capture this particular event.

Animal
1 Feb 2010, 2:20 AM
Looks like RowSelectionModel.handleMouseDown will have to defer the call to view.focusRow to allow the mouse gesture to complete before the element scrolls and the click pixel threshold is overrun.

evant
1 Feb 2010, 5:06 AM
That's what I was thinking, but while trying it, a delay of 100ms isn't enough (at least on my machine) to consistently fire the row and cell click events. 500ms was adequate, however it's much too long and makes the UI look sluggish.

willryanuk
16 Feb 2010, 3:38 AM
Has there been any progress on this? Can I expect this to be fixed in the next release?

mystix
16 Feb 2010, 6:23 AM
i'd like to take @animal's suggestion a step further by detecting if view.focusRow will result in scrolling -- if a potential scroll is detected, queue all cellclick / rowclick / whateverclick listeners for execution after the scroll has taken place.

this will resolve the problem of introducing an arbitrary delay which may not work under all situations.

Jamie Avins
16 Feb 2010, 9:10 AM
Has there been any progress on this? Can I expect this to be fixed in the next release?

I don't expect a fix until 3.2.x is released. The effects at the moment look to be too disruptive for a patch release.

evant
16 Feb 2010, 5:51 PM
For further info, this isn't necessarily specific to the grid:



function simulate(e, t){
var ct = Ext.getDom('ct'),
isFoo = Ext.fly(t).hasClass('foo');

if(isFoo && e.type == 'mousedown'){
var val = (ct.scrollTop + ct.offsetHeight) - (t.offsetHeight + t.offsetTop);
if(val < 0){
val = ct.scrollTop + Math.abs(val);
//ct.scrollTop = ct.scrollTop + Math.abs(val);
console.log('scrolled');
}
}else if(isFoo){
console.log('clickity');
}
}

Ext.onReady(function(){
var ct = Ext.getBody().createChild({
id: 'ct',
tag: 'div',
style: 'width: 200px; height: 200px; border: 1px solid red; overflow: auto;'
});

for(var i = 0; i < 100; ++i){
ct.createChild({
tag: 'div',
cls: 'foo',
html: 'Item ' + (i + 1),
style: 'cursor: default; border-bottom: 1px solid blue;'
});
}

ct.on({
mousedown: simulate,
click: simulate
});
});

willryanuk
17 Feb 2010, 4:13 AM
Okay- I'll wait for the 3.2 release. The roadmap suggests early March- is that still about right?