Mask for cell value

Tags: #<Tag:0x00007f8b1d712b40>

There is any method to aply mask in a cell value? Like in pt-BR we have an mask for one of ours number documentation called cpf and cnpj like that ‘18.229.419/0001-85’. So I have to put this mask in the cell value when the user type in the cell. It is possible?

Hi @dartajunior3

To fully understand the requirements I would need answers to the following questions.
Handsontable cell is constructed from a cell editor, validator, and renderer.

  1. Renderer - what should be visible from the user when they do not edit the cell
  2. Editor - what should be visible within the input when users type and are all chars valid
  3. Validator - what are the valid values for those cells if there were not blocked in the editor

Additionally, do you want to allow copying and pasting those cells or any cells to them (the same applies to the autofill functionality).

So as a user I want to be able to input one cnpj value on a cell, and this cnpj value render with a mask like:
I input 18229419000185 in the cell, then it render for me this way 18.229.419/0001-85.
Other scenario is when i get this cnpj value from an API, só I wiil just injet the value in the cell but not input by keyboard.

Does this demo meet your requirements https://jsfiddle.net/19fqtzx4/ ?

1 Like

Yes thats what I want thanks

1 Like