[CLOSED] usMoney turns negative numbers into positive

  1. #1

    [CLOSED] usMoney turns negative numbers into positive

    The problem seems to be in format.js where usMoneyTemp() strips off the negative sign in the String().replace() statement.
  2. #2

    RE: [CLOSED] usMoney turns negative numbers into positive

    Hi,

    Please provide test case. For me the following code
    Ext.util.Format.usMoney(-1000)
    gives
    "-$1,000.00"
    Negative sign is presented in the output
  3. #3

    RE: [CLOSED] usMoney turns negative numbers into positive

    I should have said that this is in version 1.0.
  4. #4

    RE: [CLOSED] usMoney turns negative numbers into positive

    Hi,

    Yes, I tested under 1.0
  5. #5

    RE: [CLOSED] usMoney turns negative numbers into positive

    Here is the code I tried:

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
        
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    </head>
    <body>
        <ext:ResourceManager runat="server" />
           
        <h2>1. Button with Listener</h2>
        
        <ext:Button runat="server" Text="Click Me">
            <Listeners>
                <Click Handler="alert(Ext.util.Format.usMoney(-1000));" />
            </Listeners>
        </ext:Button>
    </body>
    </html>
    You press the button and you get $1,000.00

    If you look at the code in format.js:

    Ext.util.Format.usMoney = function (v) {
        return Ext.util.Format.usMoneyTemp(String(v).replace(/[^0-9\.]/g, ""));
    };
    It's clearly replacing everything that is not a digit or a period with "".

    I have the latest 1.0 code.
  6. #6

    RE: [CLOSED] usMoney turns negative numbers into positive

    Hi,

    Thanks for the sample. Just I tested on pure ExtJS.
    Now it is fixed. Please update from SVN
  7. #7

    RE: [CLOSED] usMoney turns negative numbers into positive

    Just to link a couple threads together here, this defect was related to the following fix,

    http://forums.ext.net/showthread.php...1.aspx#bm22689


    Geoffrey McGill
    Founder
  8. #8

    RE: [CLOSED] usMoney turns negative numbers into positive

    Thanks for the quick turn around. Please close the issue.

Similar Threads

  1. [CLOSED] How to remove negative values in export
    By Vasudhaika in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 09, 2011, 1:30 PM
  2. negative id values while exporting data
    By emon in forum 1.x Help
    Replies: 0
    Last Post: Mar 05, 2011, 6:12 AM
  3. [CLOSED] How to use format like "UsMoney" for TreeGridColumn
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 24, 2010, 4:24 PM
  4. ComboBox - Template format value usMoney
    By Tbaseflug in forum 1.x Help
    Replies: 2
    Last Post: Apr 22, 2009, 5:34 PM
  5. usMoney - No Decimals
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Apr 15, 2009, 5:27 PM

Posting Permissions