We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Number Formatting in Ej2 Pivotgrid

Thread ID:

Created:

Updated:

Platform:

Replies:

145204 Jun 12,2019 10:23 AM UTC Jun 17,2019 01:31 PM UTC JavaScript - EJ 2 4
loading
Tags: PivotGrid
Bhavesh Patil
Asked On June 12, 2019 10:23 AM UTC

Hi,

i have a pivotgrid where i want to display number with group separator with 2 numbers. For example: I want display the number in these format like 12,82,500.50. So can you please tell me how to do these. I have use format:'n2'.

Jagadeesan Pichaimuthu [Syncfusion]
Replied On June 13, 2019 07:27 AM UTC

Hi Bhavesh, 
  
You can format value fields using formatSettings. Please refer following code snippet. 
  
Code Snippet: 
var pivotGridObj = new ej.pivotview.PivotView({ 
    dataSource: { 
        values: [{ name: 'Sold'caption: 'Units Sold' }, { name:'Amount'caption: 'Sold Amount' }], 
        formatSettings: [{ name: 'Amount'format: 'N2' }], 
    } 
}); 
pivotGridObj.appendTo('#PivotView'); 
  
  
  
  
Please let us know if you need further assistance on this. 
  
Regards, 
Jagadeesan 


Bhavesh Patil
Replied On June 13, 2019 10:57 AM UTC

With just using format n2 is not heIpfull. I want display the number Grouping in these format like 12,82,500.50.

Manikandan Murugesan [Syncfusion]
Replied On June 14, 2019 05:49 PM UTC

Hi Bhavesh, 
 
Currently, we are analyzing your requirement. And, we will update you the details on 17th June 2019.  

Regards, 
Manikandan. 


Manikandan Murugesan [Syncfusion]
Replied On June 17, 2019 01:31 PM UTC

Hi Bhavesh, 
  
Thanks for the patience. 
 
You can achieve your requirement by loading ‘cldr-data’ (en-IN) using AJAX. Please refer following code snippet. 
 
Code Snippet: 
<script> 
    var pivotGridObj = new ej.pivotview.PivotView({ 
        dataSource: { 
            data: pivotData, 
            expandAll: false, 
            columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }], 
            values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }], 
            rows: [{ name: 'Country' }, { name: 'Products' }], 
            formatSettings: [{ name: 'Amount', format: 'N2' }], 
            filters: [] 
        } 
    }); 
    pivotGridObj.appendTo('#PivotGrid'); 
 
    function loadCultureFiles(name) { 
        var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json', 'currencies.json']; 
        var loadCulture = function (prop) { 
            var val, ajax; 
            ajax = new ej.base.Ajax(location.origin + '/../../scripts/cldr-data/main/' + name + '/' + files[prop], 'GET', false); 
            ajax.onSuccess = function (value) { 
                val = value; 
            }; 
            ajax.send(); 
            ej.base.loadCldr(JSON.parse(val)); 
            ej.base.setCulture('en-IN'); 
            ej.base.setCurrencyCode('INR'); 
        }; 
        for (var prop = 0; prop < files.length; prop++) { 
            loadCulture(prop); 
        } 
    } 
 
    document.addEventListener('DOMContentLoaded', function () { 
        loadCultureFiles('en-IN'); 
    }); 
 
</script> 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Manikandan. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon