When filtering a column with values of the double datatype, the filter control appears to append fictitious digits to the values. This can be observed in Telerik's Unbound demo, http://demos.telerik.com/silverlight/#GridView/UnboundMode
Looking at the code to see how the data is generated, the possible values for the unit price are 3.0000, 9.0000, 14.0000, 18.4000, 19.0000, 23.2500, 32.0000, 45.6000, and 263.5000. But then when you filter on Unit Price, the values it displays are radically different. For example, 18.4000 becomes 18.3999996185303. Is there anyway around this so the true values are displayed when choosing what to filter on?
Looking at the code to see how the data is generated, the possible values for the unit price are 3.0000, 9.0000, 14.0000, 18.4000, 19.0000, 23.2500, 32.0000, 45.6000, and 263.5000. But then when you filter on Unit Price, the values it displays are radically different. For example, 18.4000 becomes 18.3999996185303. Is there anyway around this so the true values are displayed when choosing what to filter on?
7 Answers, 1 is accepted
0
Barnes
Top achievements
Rank 1
answered on 29 Jan 2013, 04:29 PM
I am experiencing this too. Please can we get this query answered.
Thanks in advance
Thanks in advance
0
Hello,
I have opened the demo and checked the values. Indeed there is a value that is displayed as '45,6.' (for example as the values are created randomly) in the cell and when I open the Filtering control it is displayed as '45,599998...' in the DistinctValues list. But when I clicked on it the values were filtered fine. When I entered "45,6" in the first Field Filter, it was filtered fine again.
Is the way the value is displayed in the DistinctValues list what you experience as a problem?
All the best,
Didie
the Telerik team
I have opened the demo and checked the values. Indeed there is a value that is displayed as '45,6.' (for example as the values are created randomly) in the cell and when I open the Filtering control it is displayed as '45,599998...' in the DistinctValues list. But when I clicked on it the values were filtered fine. When I entered "45,6" in the first Field Filter, it was filtered fine again.
Is the way the value is displayed in the DistinctValues list what you experience as a problem?
All the best,
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Barnes
Top achievements
Rank 1
answered on 31 Jan 2013, 01:10 PM
Yes, for me, but I have hijacked this post. The values displayed in the distinct list are not the values displayed the grid.
0
Hi,
Didie
the Telerik team
Thank you for this feedback. We are going to further investigate the case and check why the ListBox inside the FilteringControl displays the values that way.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Accepted
Barnes
Top achievements
Rank 1
answered on 31 Jan 2013, 01:27 PM
Incidentally, the problem does not occur when the data type is decimal. I hope this helps you to identify the problem.
0
Accepted
Hello,
Didie
the Telerik team
You are right. It seems to be a general issue with the double values displayed in the stock Silverlight ListBox.
What you can do to avoid such inconvenience is to define a StringFormat for the Binding, or a DataFormatString for the column (for example DataFormatString="{}{0:N2}").
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Josh
Top achievements
Rank 1
answered on 05 Feb 2013, 08:39 PM
Not exactly what I wanted to hear. We're using DataTemplates to display the data, so using DataFormatString won't really work. But thanks to Barnes for pointing out this issue doesn't exist for Decimal types.
Thanks for looking into it Didie.
Thanks for looking into it Didie.