I think I found another undesirable issue with the Grid. When mapping a BigDecimal to a column, only 3 decimal places are being saved. Interestingly, it is rounding, so I am under the impression that this is designed this way for some reason.
I have attached a very simple project that demonstrates this. If you try running the application and editing the Value column, you will see that all data gets rounded at 3 decimal places. (by the way, to save a value to the Grid you need to use the UP/DOWN arrows … don’t ask)
How do I change the number of decimal places?
In the actual project, I managed to switch to double where decimal places was pracitaclly infinite, but then I get precision then got funky with some decimals and worse it can’t handle NULL values. Changing to Double, however, put me back to where I started, only storing 3 decimal places.
Am I doing something wrong? Maybe I am missing something obvious? 21338.zip (63.9 KB)
It’s the StringToBigDecimalConverter that is converting BigDecimal to String using rounding. You need to provide your own converter that has more decimal places reserved for presentation.
Thanks, Johannes. I’m sorry to ask, but do you have any insight as to how this can be done? I found examples of the converter online, and see how to fix it, but am unclear as to how to bind my new converter to the Grid.
OK, now I feel stupid. I am obviously close, but I can’t figure out what I’m doing wrong. I have implemented my converter, and know it is being called because I can see convertToPresentation is being called, but nothing I do seems to effect the number of decimal places it recognizes.
I have overriden all the functions in AbstractStringToNumberConverter, and still nothing. Outside of convertToPresentation, it seems the other functions are dead. Here’s where I’m at now (Its weird, I know, but I’ve tried a lot), maybe someone can point me in the right direction?