This is a migrated thread and some comments may be shown as answers.

[Solved] Filtering on decimal columns

1 Answer 290 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Piotr
Top achievements
Rank 1
Piotr asked on 04 Jan 2012, 10:39 AM
Hi,
I've spotted a strange behaviour of on-grid filter panel when filtering decimal columns. First of all if I enter a number with more decimal places than 3 and press 'FIlter' button, the number is truncated to 2 decimal places. Grid control should not interact in the number that I've typed in to the field.

The second thing is that when one types in a number with more than 4 decimal places into the filter field and press Backspace, the number is truncated and again it only has 2 decimal places.

I think grid filters should not behave like this and should not override values typed in by user.
Regards
Piotrek

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 05 Jan 2012, 01:27 PM
Hi Piotr,

Generally speaking to control the number of digits after the decimal point you need to configure the digits property of the TextBox object. For example you can set it to 10 instead of 2 which is the default value.
In the example below OnLoad is a JavaScript function handling the OnLoad event of the Grid.
function onLoad() {
            $(this).find("th .t-grid-filter").click(function () {
                setTimeout(function () {
                    debugger;
                    $('.t-filter-options input').each(function () {
                            $(this).data('tTextBox').digits = 10;
                        });
                }, 10);
            });
 }


Greetings,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
Piotr
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or