Escribir en mayusculas cuando des editar a una celda

Tags: #<Tag:0x00007efc72fa38c0> #<Tag:0x00007efc72fa3500>

I have an issue where I need all the texts that are written in the cells to be edited, since that information is not written in capital letters if the uppercase letters are not activated.

Hi @guillermo.050526

I’m sorry but I don’t understand what the issue is. Can you please send a code demo? Also, please translate the topic’s title to English.

HI. @adrian.szymanski
What happens is that when I edit a cell I need all the texts that are entered to be converted to uppercase, I don’t have code, I really don’t know if it can be done.
I have something like that but it’s not correct.

afterChange: function(changes, source) {
if (source === ‘edit’) {
changes.forEach(([row, prop, oldValue, newValue]) => {
if (newValue !== null && newValue !== undefined) {
const upperCaseValue = newValue.toUpperCase();
this.setDataAtCell(row, prop, upperCaseValue, ‘uppercase’);
}
});
}
}

@guillermo.050526

Do you mean something like this? https://jsfiddle.net/12uzr8mg/

This solution is based on a custom editor and also uses toUpperCase() method.

@adrian.szymanski

I created this code but it updates to uppercase after I click outside the cell, not at the moment when I am writing as I want.

https://jsfiddle.net/op69qksc/1/

Hola Guillermo!

I’m here for @adrian.szymanski as he’s away this week for a conference.

I think I have the right demo: https://jsfiddle.net/behco5v1/. I wanted to use the beforeKeyDown hook, but it’s only a getter, so we won’t be able to alter the value. However, it seems that the native input event on the table does a great job.

Now, if you’d like to alter that to support only some of the cells, then you can add them a custom CSS class name and then base that input on that class.

If you’d need anything else, please let me know.

HI @aleksandra_budnik Can you help me adapt it to this code? The way you sent it to me is fine, it was what I wanted, but I have the programming like this, https://jsfiddle.net/dyuak6zv/20/ not how you sent it to me, and I don’t know how to adapt it. Thanks for the support in advance.

Sure. Here you go: https://jsfiddle.net/nokrwa1t/1/. We just needed to pass the container’s name (that was the only change).

If you would need anything more than that please let me know.

ps. if you prefer email communication we also reply at support@handsontable.com

HI. @aleksandra_budnik

Thank you very much for the support. I am closing the topic.

1 Like