[CLOSED] blank space as thousand separator

  1. #1

    [CLOSED] blank space as thousand separator

    Hello,

    How can I specify a blank space as thousand separator?

    Thanks in advance,

    Romuald.
    Last edited by Daniil; Apr 25, 2011 at 8:05 AM. Reason: [CLOSED]
  2. #2
    Hi,

    I have prepared the following example basing on
    http://forums.ext.net/showthread.php?11337

    Example
    <%@ Page Language="C#" %>
      
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
      
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[]
                {
                    new object[] { 200000.12 },
                    new object[] { -1123.42 },
                    new object[] { 3.42 },
                    new object[] { -0.42 },
                    new object[] { -42.456 },
                    new object[] { 10000042.456 },
                    new object[] { -99000042.456 },
                    new object[] { 99000042.451 },
                    new object[] { 32.429 },                         
                    new object[] { 15300.99 },
                    new object[] { -15300.99 },
                    new object[] { -5199.98 },
                    new object[] { 5199.98 }
                };
                store.DataBind();
            }
        }
    </script>
      
    <!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 runat="server">
        <title>Ext.Net Example</title>
      
        <script type="text/javascript">
            var myFormat = 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);
                v = String(v);
                var ps = v.split('.'),
                    whole = ps[0],
                    sub = ps[1] ? '.' + ps[1] : '.00',
                    r = /(\d+)(\d{3})/;
                while (r.test(whole)) {
                    whole = whole.replace(r, '$1' + ' ' + '$2');
                }
                v = whole + sub;
      
                return v;
            }
        </script>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
            <Store>
                <ext:Store runat="server">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="money" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="ind" DataIndex="money">
                        <Renderer Handler="return myFormat(value);" />
                    </ext:Column>
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] How to allow thousand separator in ext:NumberField?
    By sailendra in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 07, 2012, 10:35 AM
  2. [CLOSED] Blank space at the end of gridpanel
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Feb 15, 2011, 6:17 PM
  3. [CLOSED] "Blank" gridpanel column until edited...then blank again!
    By dmoore in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 24, 2011, 4:11 PM
  4. [CLOSED] Thousand separator in number Field
    By FpNetWorth in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 28, 2010, 1:01 PM
  5. [CLOSED] How to avoid using Thousand Separator in Coolite Number Field
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 02, 2010, 8:29 AM

Tags for this Thread

Posting Permissions