1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    6
    Vote Rating
    0
    prd0000 is on a distinguished road

      0  

    Default Displaying different value for currency from Integer type

    Displaying different value for currency from Integer type


    Hi,

    I am using integer type for my money type, and would like to display them as (value / 1000) only on display and (value * 1000) upon receiving user input. So user only know if they enter for example 12345.67, but it will be stored and processed internally as 1234560. Also for display, they will also displayed as 12,345.67

    float data type is out to the window. Our number reach around 2 billion. Our currency rates around 9.8K to 10K IDR per 1 USD. So you get the picture know how big our number is. Problem is, we still need that cent part.

    Can we do it on grid level? Or should I do it on model level? How?

    Thank you for helping.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The display should take care of this, the model should just hold the data. If you just want to format a number you can use Ext.util.Format.currency(). Otherwise you can create the string yourself.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1