Skip to main content

patternMask

Optional. Sets an input mask for entering number and string values according to a special pattern

Usage

patternMask?:
| {
pattern: ((value: string | number) => string) | string,
charFormat?: {
[char: string]: RegExp
}
}
| string,

Parameters

The patternMask property can be set in two ways:

  • as an object with the following properties:
    • pattern - (function | string) allows specifying the necessary mask and change it dynamically, depending on the entered values. Can be set as:
      • a function that takes as a parameter an entered value specified as a string or as a number and returns a string with a pattern mask
      • a string with a pattern mask
    • charFormat - (object) allows specifying a regular expression for an optional symbol. It is set as an object with key:value pairs, where the key is a symbol and the value is a regular expression
  • as a string allows setting a mask as a string using a predefined set of symbols

Example

const grid = new dhx.Grid("grid_container", {
columns: [
{
id: "employee_id",
header: [{ text: "Employee ID" }],
patternMask: "ID.000"
},
// more columns configuration objects
],
// more options
});

Related article: patternMask

Related sample: Grid. Pattern and number masks