[CLOSED] SummaryRenderer Format

  1. #1

    [CLOSED] SummaryRenderer Format

    I found Ext.util.Format.usMoney,Is there any thing for Indian rupee.
    Last edited by Daniil; Oct 10, 2014 at 3:36 PM. Reason: [CLOSED]
  2. #2
    Hi @matrixwebtech,

    Unfortunately, no.

    But, fortunately, that you can always implement your own Renderer. This thread might help.
    http://forums.ext.net/showthread.php?35641
    Last edited by Daniil; Jul 14, 2014 at 1:10 PM.
  3. #3
    Hi daniil,with your example I try

    Example View
    <script type="text/javascript">
    
        Ext.util.Format.indianMoney = function (v) {
    
            v = String(v).replace(/[^0-9.\-]/g, "");
            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');
            }
    
            return "₹ " + whole + sub;
        };
    
    </script>
      @X.ResourceManager()
    
            @(
    
                            Html.X().GridPanel()
                            .ID("GridPanel1")
                           .Store(
                            Html.X().Store()
                            .DataSource(ViewBag.loadgrid)
                            .Model
                            (
                            X.Model()
                            .ID("mid")
                           
                            .Fields
                            (
                            X.ModelField().Name("text").Type(ModelFieldType.String),
                             X.ModelField().Name("value").Type(ModelFieldType.Float)
                            )
    
                            )
                            )
                            .ColumnModel(
                           Html.X().Column().DataIndex("text").Text("text").Flex(1).StyleSpec("text-align:right"),
                            Html.X().Column().DataIndex("value").Text("value").Flex(1).StyleSpec("text-align:right")
                            .Renderer("Ext.util.Format.indianMoney")
                             )
                           
                         
                            )
    Example Controller
    public class textalignController : Controller
        {
            //
            // GET: /textalign/
    
            public ActionResult Index()
            {
                ViewBag.loadgrid = getSampleData();
                return View();
            }
    
    
            private List<textalign> getSampleData()
            {
                List<textalign> _textalign = new List<textalign>();
                _textalign.Add(new textalign
                {
    
                    text = "Sample text",
                    value = 10.36,
    
                });
                _textalign.Add(new textalign
                {
    
                    text = "some more Sample text",
                    value = 25.38,
    
                });
    
                return _textalign;
            }
        }
    
        public class textalign
        {
            public string text { get; set; }
            public double value { get; set; }
        }
    the Indian rupee symbol displayed in Firefox ,but not in chrome(Version 37.0.2062.103 m) and IE 11.
  4. #4
    Please try
    ...
    alert('I am here.');
    return "₹ " + whole + sub;
    to ensure the code is actually executed.

    If it is not executed, please try to clear a browser's cache.

Similar Threads

  1. [CLOSED] Customize SummaryRenderer view
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Jul 14, 2014, 6:40 PM
  2. [CLOSED] Razor - SummaryRenderer
    By OriCoder in forum 2.x Legacy Premium Help
    Replies: 11
    Last Post: Feb 15, 2013, 2:17 PM
  3. SummaryRenderer with null values
    By PetrSnobelt in forum 2.x Help
    Replies: 0
    Last Post: Oct 19, 2012, 1:18 PM
  4. [CLOSED] SummaryRenderer Fn in 2.0
    By gets_gui in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 12, 2012, 2:46 PM
  5. Replies: 1
    Last Post: May 05, 2011, 3:47 PM

Tags for this Thread

Posting Permissions