Docs
API
  • format

    Object

    Formatting depends on localization. About localization read Localization
    The main formatting field is date.
    For that it is used properties: edit, read, write.
    Another extra property is inputFn.
    inputFn formats displaying value.
    inputFn is used for almost all fields.

    Example: Date formatting

    
    ...
    buttons: [{
      type: 'date',
      emptyText: 'm.d.Y',
      format: {
        read: 'm.d.Y',
        write: 'm.d.Y',
        edit: 'm.d.Y'
      }
    ...
    

    Example: inputFn

    
    ...
    buttons: [{
      type: 'number',
      emptyText: '$80,000',
      format: {
        inputFn: function salaryInputFn(value){
          value = value.toString().replace('$', '').replace(/\,/g,'').replace('-', '').replace('.', '');
            
          if(value.length === 0){
            value = '';
          }     
          else if(value.length > 6){
            value = value.substr(0, 6);
            value = '$' + value.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
          }
          else{
            value = '$' + value.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
          }
          
          return value;
        }
      }
    ...
    

    Default

    
    undefined
    

    See also

    Property format