3.2.0

mask edit for grid cell

How can i use a masked edit for a cell ?
Hector
June 25,
Some Info ???
June 30,
What exactly do you mean by 'masked edit'?

If you are looking for a way to restrict/filter user input - you can do it using onCellTextChanging event -

obj.onCellTextChanging = function(text, column, row){

    if (column == 1) { // column-1 only
        if (text.match(/[^0-9.+-]/)){
            return "error"; // prevent non-digits
        }
    }
}


See also a sample code in examples\grid behavior - editing\editing.htm
Alex (ActiveWidgets)
June 30,
For example for a column for phone numbers or social security numbers something like 9999-99-9999-99 that mean input numbers in this format, or (999) 99-999 or letters and numbers like AA-999-99
June 30,
I've try to use onCellTextChanging but have problems to update cell value.
grid.onCellTextChanged = function(text, col, row) {
if (col == 1) {
// mask_onSetFocus(text, '9999-99-9999-99');
// alert(text);

var a = text.split("-").join("");
if (a.length < 13){
if (a.length > 10)
text= a.substr(0, 4) + "-" + a.substr(4, 2) + "-" + a.substr(6, 4) + "-" + a.substr(10);
else
if (a.length > 6)
text= a.substr(0, 4) + "-" + a.substr(4, 2) + "-" + a.substr(6);
else
if (a.length > 4)
text= a.substr(0, 4) + "-" + a.substr(4);
}

grid.setCellText(text,col,row);


}
}
June 30,
this onCellTextVhanging doesn't work.........
July 1,
Some info,......
July 7,

This topic is archived.

See also:


Back to support forum