How to add suffix in cells

Tags: #<Tag:0x00007efc6493c1c0> #<Tag:0x00007efc64947f70>

so imagine a column that should be filling with percentages with the suffix “%”.

for example a user comes and he wants to write 12.5% ,so i want to displays the sign % once he starts to type so :

Before he starts to type, the cell displays null.

And when he starts to write “1” , the cell shows “1%”.

Then when he types “2” the cell shows “12%”.

And when he types “.” the cell shows “12.%”.

And when he types “5” the cell shows “12.5%”

I used afterChange and afterValidate to display the suffix % , but these events triggers once the user clicks enter, so i want it to display while the user is typing like in Excel when we fills percentages . i thought by using beforeKeyDown event but i couldn’t do it

Hi @namrouche993

Thank you for contacting is. You can add suffix with help of afterBeginEditing hook and assign it to the chosen column. Here’s an example: https://jsfiddle.net/aszymanski/6xbwd5sy/

1 Like

@adrian.szymanski
Thanks a lot , so please can i set the sign % in the end instead of begining

Hi @namrouche993

To put the % sign at the end of the typed value is quite complicated within our implementation of the cell editor. It would, most likely, require to build a custom editor. Can you please send me your license ID at support@handsontable.com so I can check your current support plan?

1 Like