Filtering Columns with datatype double?

11 posts, 0 answers
  1. Dominik
    Dominik avatar
    38 posts
    Member since:
    Mar 2011

    Posted 06 Oct 2011 Link to this post

    Hi

    We are using the latest release of the Telerik Gridview control for Silverlight 4 in combination with ria services.
    Filtering normally works but we have now encountered a problem with the standard filter control when the datatype is a nullable double:
    Upon entering a number the filter control will increase the value by factors (example: value 5.00 would be changed to 500.00). It is therefore not possible to enter the correct value.

    What can we do about this? Will there be a fix in the next release?

    Thanks for your help.

    Dan
  2. Dominik
    Dominik avatar
    38 posts
    Member since:
    Mar 2011

    Posted 10 Oct 2011 Link to this post

    Have you any idea, how to work around the issue or will it be fixed in the next release? It is very easy to reproduce.

    Greetings
  3. DevCraft banner
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Oct 2011 Link to this post

    Hello Dominik,

     Thank you for this report.

    I have created a sample project with a RadGridView. One of its columns is bound to a nullable double property. Unfortunately by running this project I was not able to reproduce the behavior that you have described.

    Please check the attached project and let me know how is it different from yours?

    Greetings,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Dominik
    Dominik avatar
    38 posts
    Member since:
    Mar 2011

    Posted 11 Oct 2011 Link to this post

    Hi

    The issue is easily reproducable in your solution. The first time you filter it works although the value in the textbox changes to 300 when you enter  the value 3 (and not 3.00). However, afterwards, one can no longer correctly filter.

    Greetings

    Ps: i also tested with the latest release of your controsl. The issue also exists there
  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 13 Oct 2011 Link to this post

    Hello Dominik,

    When I change the value in the field editor textbox, then instead of '3.00' I get the value '30.00'. I need to delete the '0' myself. 
    The field editor for the double value is RadMaskedTextBox.  Unfortunately this is the expected behavior of the RadMaskedTextBox. For the Q3 2011 release we have scheduled to change the filter editor for double to be MaskedNumericInput field, that will allow the direct input of number. 

    Until then you could change the Mask of the editor. In order to do this you need to handle FieldFilterEditorCreated event of RadGridView:
    private void clubsGrid_FieldFilterEditorCreated(object sender, Telerik.Windows.Controls.GridView.EditorCreatedEventArgs e)
            {
                if (e.Editor is RadMaskedTextBox)
                {
                    (e.Editor as RadMaskedTextBox).Mask = "your mask here";
                }
            }

    I hope that this is helpful.

    Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  7. Dominik
    Dominik avatar
    38 posts
    Member since:
    Mar 2011

    Posted 16 Oct 2011 Link to this post

    Hi

    Thanks for your answer. Thats great. However, do you know which mask I have to enter, so that the input is correct for a decimal value.

    The target behaviour is as follows: It should be possible to enter two digits after the coma.

    Entered:                    result:
    1                                1.00     (displaying 1 would also be ok)
    2.23                           2.23

    In my case, the textbox always multiyplies the displayed value by 100 (example: 3   will be changed to 300.00)
    The best (most correct) result i have with a mask == "n0", this way the displayed value is correct but i can no longer enter decimal values, which is not acceptable.

    Thanks for your help
  8. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 19 Oct 2011 Link to this post

    Hi Dominik,

     Indeed there is not an appropriate mask. This is definitely a problem. That is why you could change the field editor of the FilteringControl to be RadMaskedNumericInput. As I have mentioned in my previous reply we have scheduled to change the filter editor for double to be MaskedNumericInput field.

    There is a new method added to GridViewBoundColumnBase:

    public virtual FrameworkElement CreateFieldFilterEditor()
    {
        returnFilterEditorFactory.CreateEditor(this.DataType);
    }

    It gives us a perfect opportunity to replace the default field filter editor with the desired one. I have prepared a sample project on how this could be done.  Please check it and let me know if this solution could be applied to your scenario.

    Best wishes,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  9. Farkas
    Farkas avatar
    3 posts
    Member since:
    Jul 2010

    Posted 02 Sep 2013 Link to this post

    Hi,

    I'm using raddatagrid with double datatype column, and the dinstinct values are not listed correctly. There are too many decimals however I add the value list, as you see in column.
    Can you help, why appear those decimals?

    Thanks,
    Laszlo
  10. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 03 Sep 2013 Link to this post

    Hello Laszlo,

    This 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}").

    Regards,
    Didie
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  11. Josh
    Josh avatar
    27 posts
    Member since:
    Feb 2012

    Posted 03 Sep 2013 Link to this post

    If you are able to change the type of your column, I do not believe this problem exists for Decimal datatypes.
  12. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 04 Sep 2013 Link to this post

    Hello,

    The problem is only with Double values. If your values are of type Decimal, then they will be displayed fine. 

    Regards,
    Didie
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
DevCraft banner