SMART datagrid v1.4 > Examples

[ grids ver.1.4.0]   Back  Forward

Text Editors 2  Example

1. 사용자 입력 제한

TextCellEditor.keyCallback을 이용하면 사용자 입력을 제한할 수 있다. 또, noHangul 속성을 true로 지정하면 한글 키 입력을 무시할 수도 있다. 

아래 예제에서 두 속성을 설정해서 "제품코드" 컬럼 셀에서 숫자만을 입력하도록 입력을 제한하고 있다. 

Grid - 1
0 rows
Code -1
    grid.setColumns([{
        "name": "commCode",
        "editor": {
            "noHangul": true,
            "keyCallback": function (index, key, code, pos, text) {
                if (key < '0' || key > '9') return false;
            }
        }
    },
    ...
    ]);

소스보기 

See Also
CellEditor.keyCallback
TextCellEditor.noHangul
LineCellEditor
MultiLineCellEditor
DataColumn.editor
EditOptions
GridBase.editOptions
Examples
Text Cell Editors
List Cell Editors
Number Cell Editor
Date Cell Editor
셀 편집