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

Multiple Currency in Grid

3 Answers 317 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fernando
Top achievements
Rank 1
Fernando asked on 04 May 2014, 12:20 PM
Hello,

A little briefing:

In most of the pages in my web site we need to show always the same currency symbol but for different culture,

Eg.: User culture is "en-US", but the currency symbol for the currency that I have to display is £, I need to use the currency symbol position, thousand and decimal separator from the culture, but the £ currency symbol. I solved this scenario by:

kendo.culture("en-US");
kendo.culture().numberFormat.currency.symbol = 
"£";

That's working very well, the problem comes when I have multiple currencies in the same grid. 

I have a "Currency" type that basically have the "Value" and "CurrencySymbol" properties, I could do something like:

columns.Bound(c => c.PropertyOfTypeCyrrency).ClientTemplate(" #= PropertyOfTypeCyrrency.CurrencySymbol # #= PropertyOfTypeCyrrency.Value #");

But it will not have the right Currency position (right, left, right with space, left with space), thousand and decimal separator.

While I was writing this post I just figured out that I can solve by:
columns.Bound(c => c.PropertyOfTypeCyrrency).ClientTemplate("#= kendo.toString(PropertyOfTypeCyrrency.Value, 'C').replace(kendo.culture().numberFormat.currency.symbol, PropertyOfTypeCyrrency.CurrencySymbol) #");

Is there any other approach?
Also, how do I configure the Filter to work with "PropertyOfTypeCyrrency.Value" in this case?
For this "Currency" type I've override the "ToString()", and also I have the DisplayTemplate, is there any way to use one of those with "ClientTemplate"?

Thanks in Advanced!

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 07 May 2014, 07:24 AM
Hello Fernando,

If you would like to use different culture settings, then I will suggest you register all of the required culture JS files to the page and specify what culture the kendo.toString method should use. As it is documented, the method accepts a culture name as a third parameter. Thus you will be able to format the numeric values using different culture settings.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Fernando
Top achievements
Rank 1
answered on 07 May 2014, 08:26 AM
Hi Georgi,

Thank you very much for your reply, I'm sorry but I think I didn't explain myself well, my requirement is to change ONLY the currency symbol and not the cureency symbol position, thousands and decimal separator, which will happen if I use the kendo.toString() overload passing the culture, also can you help me with how do I make the filtering work with my "Currency" type?

Thanks in advanced!
0
Georgi Krustev
Telerik team
answered on 08 May 2014, 09:19 AM
Hello Fernando,

In that case, you will need to use a custom numeric format to specify the order of the digits and currency symbol. Nevertheless, I still suggest to use a different culture settings for each different currency you want to display.
With regards to your second question, I would suggest you examine this online demo. It shows how to define a custom widget in the filter menu. This gives you a full control over the configuration of that widget.

Regards,
Georgi Krustev
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
Fernando
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Fernando
Top achievements
Rank 1
Share this question
or