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

Integer column filter value showing as decimal

11 Answers 2831 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 10 Apr 2015, 06:16 PM
Hi, how do I get the numeric textbox in the grid filter row to show integer values for an integer column?  I can apply the filter correctly but after the filter applies it will change "33" to "33.00".

11 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 14 Apr 2015, 08:29 AM

Hello Bob,

You can set format on the filterable on the column like this:

field: "YourField",
filterable: {
        ui: function (element) {
                 element.kendoNumericTextBox({
                     format: "n0"
                 });
             }
        }

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bob
Top achievements
Rank 1
answered on 14 Apr 2015, 12:56 PM
Kiril, thanks for reply, but can you provide the syntax for the server-side wrapper?
0
Kiril Nikolov
Telerik team
answered on 15 Apr 2015, 08:59 AM

Hello Bob,

It is practically the same:

.Filterable(f => f.UI("myfilter"));
  
<script>
function myfilter(element) { 
    element.kendoNumericTextBox({
               format: "n0"
        });
}
</script>

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bob
Top achievements
Rank 1
answered on 15 Apr 2015, 03:14 PM
This doesn't work as-is when using the filter row.  I was able to verify in the Kendo UI Dojo.  It seemed to work fine for the default filter type though.  Any suggestions?
0
Kiril Nikolov
Telerik team
answered on 17 Apr 2015, 07:31 AM

Hello Bob,

It will not work for the filter row. If you are using the filter row then use the following approach:

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.filterable.cell.template

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bob
Top achievements
Rank 1
answered on 17 Apr 2015, 06:54 PM
And how do I do this for the paid product (server side)?
0
Accepted
Kiril Nikolov
Telerik team
answered on 21 Apr 2015, 10:35 AM

Hello Bob,

It is practically the same:

columns.Bound(p => p.Freight).Width(250).Filterable(ftb => ftb.Cell(cell => cell.Operator("gte").Template("foo")))

Where "foo" is the function, behind the template.

Regards,

Kiril Nikolov

Telerik

 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bob
Top achievements
Rank 1
answered on 21 Apr 2015, 01:33 PM
If anyone is interested, here's what the filter function I made looks like:

function gridFilterIntegerNumericTextbox(args) {
    args.element.kendoNumericTextBox({
        format: "n0",
        decimals: 0,
    });
}
0
Deepti
Top achievements
Rank 1
Veteran
answered on 21 Jul 2020, 08:23 AM
Could you please share the complete code snippet that how you have used it?
0
Petar
Telerik team
answered on 22 Jul 2020, 10:21 AM

Hi Deepti,

As the last reply in this thread is from 2015 and may be outdated, can you specify what functionality do you want to implement for the Grid component?

What 'complete code snippet' do you need?  

Regards,
Petar
Progress Telerik

0
Bermuda
Top achievements
Rank 1
Iron
Iron
answered on 03 Jun 2024, 06:28 PM
Hi - Hope this code example helps someone in the future. 
//Kendo Grid
columns.Bound(p => p.Id).Title("ID").Filterable(f => f.UI("onIntFilter"));
<script>

	function onIntFilter(e) {
		e.element.kendoNumericTextBox({
			format: "n0",
			decimals: 0,
		});
	}
</script>


Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Bob
Top achievements
Rank 1
Deepti
Top achievements
Rank 1
Veteran
Petar
Telerik team
Bermuda
Top achievements
Rank 1
Iron
Iron
Share this question
or