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
60
Small Decimal Value in UltraWebGrid
posted

Hi,

I have a UltraWebGrid where its values can be modified through the grid's Row Edit Template.

I have few columns in UltraWebGrid where each them has the DataType "System.Decimal".  If the decimal values in these columns are too small, it displays an exponential value on the field in Row Edit Template.

For example:
- If the value in the grid is 0.000001 (six decimals), then it'll populate 0.000001 onto the field in Row Edit Template. This is OK. 
- But, if the value in the grid is 0.0000001 (seven decimals), then it'll populate 1e-7 onto the field in Row Edit Template. Not OK.

Another wierd thing happens When I try to update the small decimal value back to the grid and trigger the "UpdateRow" server event. The value returned from the particular cell is "False" rather than the number itself. It's not even the number in exponential expression. 

For example, in grid's UpdateRow event:
If the cell value is 0.000001(six decimals), then
 e.Row.Cells(0).Value  ==> 0.000001 (OK)

But, If the cell value is 0.0000001 (or 1e-7, seven decimals)
   e.Row.Cells(0).Value ==> False

Is this a bug?

So, my question is...For small decimal number,

1)  Is there a way for me to display the actual number (not the exponential value) onto field in Row Edit Template?

2) And instead of "False", how can I get the modified number in grid's UpdateRow event?

Please don't tell me to change the column's datatype to String.

Parents
No Data
Reply
  • 5
    posted

    Hello!! Even i faced the same issue, it's a bug with the way the double precisions are handled in the control. I fixed the issue with few work around.

     1) In InitializeGrid event i just changed the datatype to string(8).

     

     for (var BandIndex = 0; BandIndex < GridControl.Bands.length; BandIndex++) {

                var CurrentBand = GridControl.Bands[BandIndex];

     

                for (var ColIndex = 0; ColIndex < CurrentBand.Columns.length; ColIndex++) {

                    var CurrentCol = CurrentBand.Columns[ColIndex];

                    if (CurrentCol.DataType == 14 /*Currency*/ || CurrentCol.DataType == 4/*Float*/ || CurrentCol.DataType == 5/*Double*/) {

                        CurrentCol.DataType = 8/*string*/; //to fix decimal point issue for lower value. For ex .00000045-> 45e-7

                    }

                }

            }

     

    note: No worries it will allow only numbers

    2)In AfterExitEditModeHandler just write this line. 

    CurrentlyUpdatedCell.setValue(CurrentlyUpdatedCell.MaskedValue);

    It solved the problem..

    Thanks.

Children
No Data