Filtering column formatted as percent

4 posts, 0 answers
  1. Matt
    Matt avatar
    25 posts
    Member since:
    Jul 2015

    Posted 16 Feb 2016 Link to this post

    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.

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 18 Feb 2016 Link to this post

    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!
     
  3. Matt
    Matt avatar
    25 posts
    Member since:
    Jul 2015

    Posted 18 Feb 2016 in reply to Boyan Dimitrov Link to this post

    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.

     

     

  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 22 Feb 2016 Link to this post

    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!
     
Back to Top