Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Percent Formatted Columns Problem
posted

We have a problem displaying and editing percent-formatted values in a Web Grid column. At a first view, everything seems to work fine, but if you start editing a little bit, you encounter a strange behavior.

The official sample on the Infragistics Web Site shows the same behavior, so I can describe the issue with the official sample and everybody easily may check this for his own.

Go to http://samples.infragistics.com/2008.1/webfeaturebrowser/default.htm and see the "UltraWebGrid - Column formatting" online sample. The second number of the "Numbers" column has a value of 123456789. Due to the initial formatting it is displayed as "123-45-6789".

Now chose the third option "#%" from the box "number format" to format that row as percentages. The displayed value changes to "12345678900%". So far so good, multiplying by 100 could be by design.

Double click the cell to enter the edit mode. The value you can edit is 123456789. That's the initial value, correct. Don't change it, just leave the edit mode by pressing escape.

We have: real value: 123456789, displayed (formatted) number: 12345678900%

But now it gets strange or let's say inconsistent - we do some editing.

Double click the cell again and change the value. You really have to change it, it's not sufficient to enter the same number again, the grid seems to shorthand its work if the number keeps identical. I choosed to add two digits to get the number 12345678900 and confirmed this change by leaving the edit mode with Return.

Now we have: real value: 12345678900, displayed (formatted) number: 12345678900%

In both cases the displayed values are identical, but the stored numbers are different! IMHO the multiplication of the initial value by 100 should be removed and the behaviour would be consistent. Unfortunately I see no chance to to that from my user code, so I assume it's an issue for Infragistics?

As said in the beginning, our application has the same problem. Regardless if you fill your table with percentages or multiply them by 100 first - when a user changes some values your whole table gets inconsitent or shows wrong values.

Any ideas, workarounds, announcements to fix this?

Matthias

  

 


  • 505
    posted

    We faced the same issue but we were using the row templates. So we were explicitly calculating the numbers to be displayed.

    So we are doing explicit multiplication and division by 100 in BeforeRowTemplateOpenHandler and

    AfterRowTemplateCloseHandler

    Try to do the same.