currency column filter value showing as Integer

7 posts, 0 answers
  1. Chinonso
    Chinonso avatar
    31 posts
    Member since:
    Jan 2017

    Posted 05 Sep Link to this post

    Hello there, i seem to be having a problem with getting a currency filter to work, i am trying to truncate any number past the decimal point. so if i have $3,456.04 , it
    should be $3,456. However, after i add the filter function, what is displayed is 3456.

    Here is the index.cshtml

    columns.Bound(e => e.EstimatedGrantedCost).Title("Est.<br>Granted<br>Cost").Width(23).HeaderHtmlAttributes(new { style = "text-align:right; font-weight:normal; font-size:80%" }).HtmlAttributes(new { @style = "text-align:right; font-weight: normal; font-size:80%" }).Filterable(x => x.UI("CurrencyFilter"));
     
       function CurrencyFilter(e) {
          //console.log("this is what was passed in:",e)
          $(e).kendoNumericTextBox({format: "c0" });
       }

     

    thanks for your help.

  2. Georgi
    Admin
    Georgi avatar
    160 posts

    Posted 07 Sep Link to this post

    Hi Chinonso,

    The provided code will work only if the filter is in mode menuIf the filter is in mode row the filter widget have to configured as follows:

    .Filterable(x=> x.Cell(y=> y.Template("currencyFilter"));

    function currencyFilter(args) {
          args.element.kendoNumericTextBox({
                format: "c0"
            });
        }

    I have assembled small sample (currency-filter.zip) which illustrates both solutions.


    Regards,
    Georgi
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Chinonso
    Chinonso avatar
    31 posts
    Member since:
    Jan 2017

    Posted 07 Sep in reply to Georgi Link to this post

    Thank you for getting back to me. The downside to this, is that it make the grid filterable which is not a desired functionality. At least, not on this particular grid. Before i resorted to using the filter function, i was using .Format("{0:c}') on the desired column. Is there any other way i can achieve the desired result? thank you  
  4. Georgi
    Admin
    Georgi avatar
    160 posts

    Posted 11 Sep Link to this post

    Hi Chinonso,

    Excuse me but I am not sure that I understand you. Could you please send me a sample with the issue and what you want to achieve, so I can provide you with suitable solution for your exact case.

    Based on the provided information I assume that the expected result is to format the value inside the EstimatedGrantedCost  column. Please correct me if I am wrong.

    As you have mentioned, in order to format the column possible solution is to use the Format property..

    e.g
    columns.Bound(e => e.EstimatedGrantedCost).Format("{0:c}")

    Is there a reason to want to use another configuration?


    Regards,
    Georgi
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Chinonso
    Chinonso avatar
    31 posts
    Member since:
    Jan 2017

    Posted 11 Sep in reply to Georgi Link to this post

    Hello Georgi.

    Originally, i was using 

    columns.Bound(e => e.EstimatedGrantedCost).Format("{0:c}") to format the column value. Which resulted in values like $3,456.04, $4,556.00. Thats all well and good. The end-user tests the code and say they don't want  any decimals. So this $3,456.04 , should be $3,456 and $4,556.00  should be $4,556. That is what i am trying to achieve.

  6. Preslav
    Admin
    Preslav avatar
    233 posts

    Posted 13 Sep Link to this post

    Hello Chinonso,

    To achieve the desired result, use format like:

    columns.Bound(e => e.EstimatedGrantedCost).Format("{0:c0}")

    More information about the number formats is available in this article:
    I hope this helps.


    Regards,
    Preslav
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  7. Chinonso
    Chinonso avatar
    31 posts
    Member since:
    Jan 2017

    Posted 13 Sep in reply to Preslav Link to this post

    Thank, i remember trying that, but for some reason, it didn't work before. Probably i was putting o instead of 0. Thanks.
Back to Top