Base solution for your next web application
Open Closed

Currency and date formats ui grid #3327


User avatar
0
onecontact created

Hi!, how can set the currency and date formats in ui-grid?

I found the cellFilter: {currency} but are getting this default? format: 1.000,00 € how can change to: 1,000.00 $?,

thanks!

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think ui-grid uses angularJs's currency filter <a class="postlink" href="https://docs.angularjs.org/api/ng/filter/currency">https://docs.angularjs.org/api/ng/filter/currency</a>. So, if you want a different behaviour than this one, you can create a custom angularJs filter and use it in ui-grid column.

    Thanks.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    onecontact created

    Hi, thank you, after I read that article, how can handle the user location?, where can set that?, or how aspnetzero handle that?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can use "abp.localization.currentLanguage.name" on the client side.

    Thanks.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    onecontact created

    Hi.. I just want to change the language, but not the date or currency format of the entire app, how can achieve this?, thanks

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    ABP's default implementation sets both CurrentCulture and CurrentUICulture here <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web/Web/Localization/CurrentCultureSetter.cs#L114">https://github.com/aspnetboilerplate/as ... er.cs#L114</a>

    If you want to change that, you need to create a new current culture setter class deriving from CurrentCultureSetter in above link and override it's SetCurrentCulture method just to set CurrentUICulture

    Currency and date format will be retrieved from CurrentCulture property. You can set it to a default one which you want to use in this method as well.

    protected virtual void SetCurrentCulture(string language)
    {
        Thread.CurrentThread.CurrentUICulture = CultureInfoHelper.Get(language);
    }
    

    Thanks.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)