3.2.0

Intercept all keystrokes in grid cells

In my ActiveWidgets-based application, date fields in application screens (which use text input fields) have a special keyboard handling routine. I attach a function to the onfocus event of the field, which then attaches a function to the onkeydown event of the field. A function attached to the onblur event of the field puts everything back the way it was before the user entered the field. While editing the field, data entry is restricted to a defined date format (MM/DD/YYYY or MM/DD/YY) and slash characters are inserted automatically. When the user leaves the field, the date value is validated and an error is displayed if it is an incorrect date and two-digit years are automatically converted to four-digit years.

Some of the grids in this same application have columns that are used for dates, and I need to apply the same type of keyboard handling to those grid cells. But I've been having trouble finding the proper way of hooking into the appropriate events for the grid cell that would work the same way as the text input field. With the impending release of version 2.5 of ActiveWidgets, it sounds like the cell processing will be radically different, so I assume it would be better to implement it based on the 2.5 architecture. So how would I hook into the grid cell equivalent of the onfocus, onblur, and onkeydown events in version 2.5?
Randall Severy
November 27,
The cell editing events are the same in AW 2.5. What is different is that edited cell always contains <input> element while in AW 2.0 IE code branch used <span> with contentEditable="true". The grid has three new methods to control editing -

obj.startCellEdit(text);
obj.endCellEdit();
obj.cancelCellEdit();

The grid also fires onCellEditStarted/onCellEditEnded events which could be used instead of onfocus/onblur. There is also onCellValidated event which fires before onCellEditEnded if the cell text has changed during editing. And finally there is onCellTextChanged event which fires on each keystroke, so it could be used instead of onkeydown. It also fires on copy/paste/delete/undo, i.e. _any_ change in the cell text.

http://www.activewidgets.com/aw.ui.grid/cell-edit-events.html

Alex (ActiveWidgets)
November 28,

This topic is archived.

See also:


Back to support forum