Formatting of Negative Number in Ext.Net Grid Column

  1. #1

    Formatting of Negative Number in Ext.Net Grid Column

    Hello. I want to display negative number in a grid column with brackets instead of - symbol e.g. -12345.00 should be displayed as (12345.00). Kindly help me with this, how it can be achieved.
  2. #2
    Use a renderer if you want custom text. or you can use a number format. Here is a renderer example

    Javascript
            var myRenderer= function (value, metaData, record, rowIndex, colIndex, store) {
    
                  if (value<0) {
                     return '(' + value + ')';
                  } else {
                     return value;
                  }
    
            };
    Ext stuff
                                    <ext:Column runat="server" Text="My Field" Width="120" DataIndex="xzy" >
                                        <Renderer Fn="myRenderer" />
                                    </ext:Column>
    I am positive you can use a number format also, but you would need to look into that furtherer
    /Z
  3. #3
    Thanks Z for your help. This has worked for me. Also if you have the number format thing ready with you then kindly share otherwise this solution works for me. Thanks a lot.

Similar Threads

  1. Replies: 1
    Last Post: Jul 18, 2016, 5:52 PM
  2. [CLOSED] Formatting 'Number' Field
    By Argenta in forum 3.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 15, 2015, 10:02 AM
  3. Replies: 4
    Last Post: May 05, 2014, 2:47 PM
  4. [CLOSED] Display negative numbersin grid column in red color
    By AnulekhaK in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 03, 2012, 11:07 AM
  5. Formatting number for NumberField
    By fac in forum 1.x Help
    Replies: 1
    Last Post: Jan 30, 2012, 4:02 PM

Tags for this Thread

Posting Permissions