currency column filter value showing as Integer

10 posts, 0 answers
  1. Chinonso
    Chinonso avatar
    48 posts
    Member since:
    Jan 2017

    Posted 05 Sep 2017 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
    703 posts

    Posted 07 Sep 2017 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
    48 posts
    Member since:
    Jan 2017

    Posted 07 Sep 2017 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
    703 posts

    Posted 11 Sep 2017 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
    48 posts
    Member since:
    Jan 2017

    Posted 11 Sep 2017 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
    591 posts

    Posted 13 Sep 2017 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
    48 posts
    Member since:
    Jan 2017

    Posted 13 Sep 2017 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.
  8. Avrohom Yisroel
    Avrohom Yisroel avatar
    53 posts
    Member since:
    Jan 2011

    Posted 20 May 2020 Link to this post

    Hi this is just what I needed to see.

    Only this shows up with dollar sign when I want the British pound sign.

    How can I make sure this shows in GBP?

    Many thanks.

  9. Georgi
    Admin
    Georgi avatar
    703 posts

    Posted 22 May 2020 Link to this post

    Hello Avrohom,

    You will have to set the culture to British. Include the following script:

    <script src="https://kendo.cdn.telerik.com/2020.2.513/js/cultures/kendo.culture.en-GB.min.js"></script>

    And set the culture to en-GB before the initialization of the widgets:

        <script type="text/javascript">
            //set current to the "en-GB" culture script
            kendo.culture("en-GB");
        </script>

    Regards,
    Georgi
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
  10. aryeh
    aryeh avatar
    1 posts
    Member since:
    May 2020

    Posted 24 May 2020 in reply to Georgi Link to this post

    Thanks this has helped me.
Back to Top