Changing cell types doesn't work as expected

Tags: #<Tag:0x00007f8b285a4d20>

Hi developers,

at first I would like to thank you for your big help and willingness. I have many questions and you helped me a lot.

For today I have one more question about unexpected functionality (from my point of view) of changing cell among cell types. Maybe I think as Excel user too.

Please consider this demo at
https://jsfiddle.net/janzitniak/en98jxd4/34/

There are many buttons which can be used for changing cell types for cell at position 1, 1 via setCellMetaObject.

Scenario 1:

If I use Set Percentage button and then Set Currency and vice versa, it works as I expected, means that number is show in percentage respectively in currency format.

Scenario 2:

Then I want reset that cell type (formatted as percentage or currency) therefore I used text cell type but it doesn’t work in my demo.

Also if I want change that cell to date or numeric, it doesn’t work as well.

Scenario 3:

If I use Set date cell type at first and then to any other cell types, it doesn’t change anything.

Scenario 4:

If I use Set text cell type at first and then to any other cell types, it doesn’t change anything.

Scenario 5:

If I use Set numeric cell type at first and then to Set Percentage or Set Currency it works but other cell types don’t change anything.

Regards
Jan

Hi @jan.zitniak

You have to update all crucial properties for the respective type.

So if you for example Set Percentage or Set Currency and then try to Set numeric you need reset numericFormat.
Sometimes you have to reset a className because numeric type has a htRight and htNumeric classes.

Additionally, update version to beta2 version 8.0.0 is helping too.

Here is an updated demo - https://jsfiddle.net/pk7v124j/

1 Like

@piotr.nowak thank you for your answer and example, now it works.

I’m glad to hear that @jan.zitniak

1 Like