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

Filtering column formatted as percent

3 Answers 346 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 17 Feb 2016, 04:57 AM

i am having problems trying to filter rows that are formatted as a percent. ({0:p2})

 I have a simple app where I am using the following in my column definition

 

Field: "sample",

title: "col 1",

format: '{0:p2}',

filterable: {

 ui: function(e) {

e.kendoNumericTextbox({

format: 'p2',

decimals: 2,

change: function(e) {

// code to handle change event

}

}

}}

 

I am now having problems when I am applying this to another application.  For some reason the change event won't fire allowing me to convert the input to a decimal thus matching the underlying data which is in a decimal format.

 

Is this the recommended method for handling percent data?  I am using local data if that makes a difference.

3 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 18 Feb 2016, 02:33 PM

Hello Matt,

 

Could you please share a runnable sample dojo example that replicates the problem in order to investigate it? 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Matt
Top achievements
Rank 1
answered on 18 Feb 2016, 03:49 PM

I'll work on getting a dojo posted today, but all I really want to know is what is the recommended way to filter a decimal column formatted as a percent.  In other words, I have a column formatted as a percent when the dataSource is a decimal.

 

 

0
Boyan Dimitrov
Telerik team
answered on 22 Feb 2016, 12:35 PM

Hello Matt,

 

In general the format option of the column changes just visually the value displayed in the cell. The underlying model remains the same. The filtering,sorting, grouping and etc operations are handled on Kendo UI DataSource level, where the value should be decimal. 

 

So in order to apply filter expression the value selected by the filter widget should match the underlying model field value. The easiest way to check what is the underlying model field value is to retrieve specific data item and check what is the field value. The data method of the Kendo UI DataSource will retrieve all data stored in the data source. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Matt
Top achievements
Rank 1
Share this question
or