PDA

View Full Version : events in the wrong order



bhomass
23 Nov 2011, 10:19 PM
I have a situation where the events I need are coming in the wrong order.

I am writing a grid which mimics the Excel UI. when I edit a grid cell and click on the formulabar above, I don't want the grid cell to go out of editing mode. Therefore, I need to intercept the onBlur() method. if formulabar was the one which triggered the onBlur, I want to skip blurring the grid cell, and therefore keep it in editing mode.

The problem is both formulabar.onFocus() and formulabar.onClick() methods on the are called after the gridcell.onBlur() method, so I can not conditionally blur my gridCell.

is there a way I can delay the gridcell.onBlur() call til after formulabar.onFocus(), or alternatively, get the formulabar.onFocus() event earlier?

This is prob an impossible question.

bhomass
24 Nov 2011, 1:02 AM
I got DeferredCommand to work for this!

bhomass
24 Nov 2011, 12:12 PM
take that back. the onblur event still jumps ahead of the grid.onclick event. Anyone knows how to delay onblur relative to grid.onclick?

Colin Alworth
28 Nov 2011, 4:16 PM
Click and Blur are dom events, fired by the browser itself. Changing your code usually isn't enough to reorder how those events fire - when a user clicks on something not in focus, first the currently focused thing must be blurred. Understanding it this way will hopefully lead to this solution - cancel the blur event, and the newly focused thing shouldn't be focused.