SMART datagrid v.1 > Classes > GridStyles

Back  Forward

DataLudi.GridStyles.textFormat  property

当在数据单元格中,显示TEXT字段的值时,将会被使用的字符串转换格式。 

在内部, 调用Javascript String.replace, 并且如同下列格式,通过由分号(;)而划分的字符串的值,指定函数调用所需信息。 至少需要指定模式和置换字符串。 

"正则表达式:置换字符串:正则表达式标志位(igm)" 

Getter
function textFormat(): String
Setter
function setTextFormat(value: String)
Code -1
    // 居民登记号码 '0102031234567' => '010203-1234567'
    column.styles().setTextFormat('(\\d{6})(\\d{7});$1-$2');
    // 电话号码 '01012345678' => '010-1234-5678'
    column.styles().setTextFormat('(\\d{3})(\\d{3,4})(\\d{4})$;$1-$2-$3');

可以在RegExLib网站等,参考大部分的模式。 

See Also
textFormat
booleanFormat
numberFormat
prefix
suffix
Examples
列样式