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

currency column filter value showing as Integer

9 Answers 647 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chinonso
Top achievements
Rank 1
Chinonso asked on 05 Sep 2017, 01:34 PM

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.

9 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 07 Sep 2017, 10:08 AM
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.
0
Chinonso
Top achievements
Rank 1
answered on 07 Sep 2017, 02:56 PM
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  
0
Georgi
Telerik team
answered on 11 Sep 2017, 07:51 AM
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.
0
Chinonso
Top achievements
Rank 1
answered on 11 Sep 2017, 01:25 PM

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.

0
Preslav
Telerik team
answered on 13 Sep 2017, 08:52 AM
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.
0
Chinonso
Top achievements
Rank 1
answered on 13 Sep 2017, 09:06 PM
Thank, i remember trying that, but for some reason, it didn't work before. Probably i was putting o instead of 0. Thanks.
0
Avrohom Yisroel
Top achievements
Rank 1
answered on 20 May 2020, 09:33 PM

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.

0
Georgi
Telerik team
answered on 22 May 2020, 07:15 AM

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.
0
aryeh
Top achievements
Rank 1
answered on 24 May 2020, 02:03 PM
Thanks this has helped me.
Tags
Grid
Asked by
Chinonso
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Chinonso
Top achievements
Rank 1
Preslav
Telerik team
Avrohom Yisroel
Top achievements
Rank 1
aryeh
Top achievements
Rank 1
Share this question
or