1. #1
    Sencha User nak1's Avatar
    Join Date
    Jan 2008
    Posts
    266
    Answers
    1
    Vote Rating
    0
    nak1 is an unknown quantity at this point

      0  

    Default Answered: Ext.util.Format.usMoney in Sencha Touch 2x

    Answered: Ext.util.Format.usMoney in Sencha Touch 2x


    Does anyone know if there's going to be a usMoney format method similar to the Ext.util.Format.usMoney field?
    No longer a Newbie

  2. No but you can apply it to Ext.util.Format yourself if you need it.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    851
    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


    No but you can apply it to Ext.util.Format yourself if you need it.
    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.

  4. #3
    Sencha User nak1's Avatar
    Join Date
    Jan 2008
    Posts
    266
    Answers
    1
    Vote Rating
    0
    nak1 is an unknown quantity at this point

      0  

    Default


    Thanks for the prompt response. I've gone ahead and added a new method to the Ext.util.Format object.
    No longer a Newbie

  5. #4
    Sencha User
    Join Date
    Mar 2009
    Posts
    227
    Answers
    1
    Vote Rating
    0
    SchattenMann is an unknown quantity at this point

      0  

    Default


    now the million dollar question is...how?



    how can i add it to a field number? i know i can do it using

    Code:
    numberfield.setValue(myFormat(value))
    but is that the only way?

  6. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    851
    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 Number field won't allow the '$', Text field will.
    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.

  7. #6
    Sencha User
    Join Date
    Mar 2009
    Posts
    227
    Answers
    1
    Vote Rating
    0
    SchattenMann is an unknown quantity at this point

      0  

    Default


    ok but can't i do it using other method?

    something like:

    Code:
    {
              xtype:'textfield',
              ....
              renderer: Ext.util.Format.usMoney
    }
    if i'm not mistaked this would work in Ext Js 3?

    or do i have to use some event to prevent every time the field value is changed to be correctly formated?

    thanks

  8. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    851
    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


    Ext JS 3 !== Sencha Touch 2. There is no renderer config.
    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.

  9. #8
    Sencha User
    Join Date
    Mar 2009
    Posts
    227
    Answers
    1
    Vote Rating
    0
    SchattenMann is an unknown quantity at this point

      0  

    Default


    uh i know mitchell, that's exactly why i'm asking for help on how to properly do it

    i know how to define it

    Code:
    Ext.util.Format.Currency = function (v) {
        v = (Math.round((v - 0) * 100)) / 100;
        v = (v == Math.floor(v)) ? v + ".00" : ((v * 10 == Math.floor(v * 10)) ? v + "0" : v);
        return ('€' + v).replace(/\./, ',');
    };
    bu i have no idea how to use it on a textfield.

    would you please mind to share how?

    only thing i can think of is to use it in renderTpl textfield config