Preventing Filter Row from Autoformatting on Blur

4 posts, 1 answers
  1. The Bearded One
    The Bearded One avatar
    5 posts
    Member since:
    Oct 2014

    Posted 30 Nov 2015 Link to this post

    Steps to reproduce...

    1. Any old datagrid with a filter row enabled

    2. Go to any numeric columns and enter a value in the filter field

    3. Blur the field (tab out or click anywhere) the value

    4. The value entered in the filter column is reformatted.

     ---

    I was trying to filter my grid with a record number of 571339. It is just an int in my view model -- not formatted as Currency. When I tab out of the grid, it reformats it to 571,339.00. It's not breaking anything, but it's annoying one of my vocal customers.

     

    How can I initialize my grid in MVC to not reformat numeric values to currency?

     

     

  2. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 02 Dec 2015 Link to this post

    Hello,

    In order to achieve this you can define a template for the filter cell. Check out the following dojo example that illustrates the approach:



    Regards,
    Viktor Tachev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. The Bearded One
    The Bearded One avatar
    5 posts
    Member since:
    Oct 2014

    Posted 02 Dec 2015 Link to this post

    Thanks!

     

    Your response got me down the trail I needed. I am initializing my grid in MVC so I ended up with this...

    columns.Bound(u => u.BemsId).Filterable(filter => filter.Cell(u => u.Template("IntegerFilter")));

     

    and then

     

            function IntegerFilter(args) {
                args.element.kendoNumericTextBox({ format: "n0", decimals: 0, spinners: false });
            }

     

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 04 Dec 2015 Link to this post

    Hello,

    Thank you for sharing your implementation with the community. This can be helpful to someone trying to implement similar feature.

    Regards,
    Viktor Tachev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET MVC is VS 2017 Ready