3.2.0

filtering characters into a cell

I would like to filter characters into a cell. In other words, I'd like to
attach a function to onkeypress and onkeyup events:

gridobj.getCellTemplate(3,1).setEvent("onkeypress", AllowOnlyLetters);

The problem is that the very first input into the cell
is not being filtered. Subsequent entries are. So
for example, if I type '1' into the grid, it appears in the cell.
I delete the '1' and attempt to type it again. It does not appear:
the expected behaviour. (Very odd!)
J Mansons
June 4,
I have observed why the code above has the odd
behaviour:
It looks like when I select a cell, the event handler is not
active. However, when I double-click on the cell, the event handler
is suddenly active.

Any reason why this is so?
J Mansons
June 4,
Normally the keyboard focus (and hence keyboard events) is attached to the grid control itself, not to the current cell.
Alex (ActiveWidgets)
June 5,
So how can the problem above be resolved? Surely the idea of filtering input into a cell is not alien.... perhaps a solution would be to attach a handler to the grid and in the handler work out which cell I am in and accept or deny certain characters? This seems like a rather long way to achieve something rather simple... Is there an elegant solution?
Jack Mansons
June 7,
The solution will be available in a couple of days with 2.0.1 release. You will be able to attach an event handler to the onCellTextChanging() event which fires with each keystroke (actually with any change in the textbox value, including copy/paste, drag and drop, etc.). If the new value does not fit your criteria you would simply cancel onCellTextChanging() event and the textbox value does not change. The same would work for maxlength filter.
Alex (ActiveWidgets)
June 7,

This topic is archived.

See also:


Back to support forum