format

a number format that should be applied to a text input

string|object format;

Example

// setting delimiters according to the locale rules
{ view:"text", value:'12345678', name:"b", label:"Comma", format:"1.111,00" },
 
// setting a custom number format
{ view:"text", value:'12345678', name:"f", label:"Phone", format:{
    parse: function(a){ return a.replace(/[^0-9]*/g,""); },
    edit: function(a){ 
        function chunk(a, n){ 
            return a.length > n ? (a.substr(0,n) + "-" + chunk(a.substr(n), n)): a;
        }
        return (a.length ? "+": "") + chunk(a, 3);
    },
}}

Related samples

Details

To set a custom number format, specify the property value as an object with two attributes (as in the above example):

  • parse - the function that handles a real value kept by the control
  • edit - the function that handles a value that will be rendered
See also
  • Articles
  • Back to top