:: Forum >>

mask edit for grid cell

How can i use a masked edit for a cell ?
Hector
Thursday, June 25, 2009
Some Info ???
Tuesday, June 30, 2009
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)
Tuesday, June 30, 2009
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
Tuesday, June 30, 2009
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);


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

This topic is archived.


Back to support forum

Forum search