Currency symbol in Wijmo Pivot Grid

Posted by: chinmay.patil on 19 January 2018, 8:41 am EST

    • Post Options:
    • Link

    Posted 19 January 2018, 8:41 am EST

    Hi team,

    Im using wijmo pivot grid, to generate grid with currency values. I also want to display the currency symbol along with the values. Also it has to be configurable , which currency symbol to be shown. Is there any way to achieve this?

  • Posted 21 January 2018, 6:14 pm EST

    Hi Chimay,

    You need to change the PivotField format to “c”. Also, if you would like to change the currency symbol for Wijmo controls, there are two ways to accomplish this:

    #1

    Include required culture file into the project. Please refer to the documentation for the same.

    http://demos.wijmo.com/5/Angular/WijmoHelp/WijmoHelp/static/globalization.html

    #2

    Change the currency symbol by accessing culture object as following code snippet:

     wijmo.culture.Globalize.numberFormat.currency.symbol='#';
    

    Please refer to the attached sample for the same.

    ~Manish

    PivotGrid_FormatField.zip

  • Posted 22 January 2018, 5:19 pm EST

    Hi Manish,

    In the second method, is the Globalization at grid level or can it also be configured at Column level.

    If i want to display multiple formats in the same grid, for eg. if i want Expense in USD as well as EUROs can it be done using the culture file?

  • Posted 22 January 2018, 9:09 pm EST

    Hi Manish,

    Thanks for the help,

    Found the required.

    http://demos.wijmo.com/5/Angular/WijmoHelp/WijmoHelp/topic/wijmo.Globalize.Class.html

    Regards,

    Chinmay

  • Posted 22 January 2018, 9:29 pm EST

    Hi Manish,

    There’s one problem though, the example you shared distorts the Grandtotal of the grid.

    Please find attached image.

  • Posted 23 January 2018, 3:22 pm EST

    Hi Chinmay,

    We are sorry for the inconvenience. This is because of the following code snippet in the sample. Please remove it, PivotGrid will work fine.

    ng.fields[i].aggregate = 4; // this returns max value in PivotGrid
    

    ~Manish

  • Posted 24 January 2018, 6:19 am EST

    Hi Manish, thanks. That helps.

    The display name as ‘Grandtotal’ got me confused.

    Will it be possible to apply culture at column level? For eg. If i want to show $ & € expenses in columns in the grid, as you may know, different norms are followed in representing the currency using ', ‘&’ . ’ separators. Can different currency formatting be done at column level of the grid?

  • Posted 24 January 2018, 6:01 pm EST

    Hi Chinmay,

    The culture can be changed at Control level. If you would like to change the culture for a column, you need to use itemFormatter for the same and alter cell text.

    itemFormatter(panel,r,c,cell){
    	if(panel.cellType==1){
    		cell.innerText= wijmo.format(parseFloat(cell.innerText,"c€ ");
    	}
    }
    

    ~Manish

  • Posted 29 January 2018, 5:08 pm EST

    Hi Manish,

    Thanks for the solution, however I’m not using the pivot panel, so failed to implement that solution,

    can you share alternative that could be used without using the pivot panel object?

  • Posted 31 January 2018, 11:40 pm EST

    Hi Chinmay,

    We are sorry for the delayed response.

    You may also add pass the PivotEngine as itemsSource to PivotGrid. Here, you need to create the PivotPanel object with fields.

    ~Manish

    PivotGridExport_PDF.zip

  • Posted 13 February 2018, 1:57 am EST

    Hi Manish,

    Sorry for the delay, i was on leave.

    I’m facing a weird issue while adding the format to the fields

    http://jsfiddle.net/yf9o4hy2/3/

    Here’s a fiddle, if i set the field format, after the fields have been initialized, it works fine, however while trying initialize the format property for the fields when im initializing the fields, gives an error :

    ** Assertion failed in Wijmo: Unknown property “0”.

    Can you please rectify the mistake im making in the fiddle above.

    Also, for the above question, you shared a zip, i tried to open it, but couldn’t understand, can you modify in the fiddle above how to initialize panel object, when im not using the Pivot Panel.

    Regards,

    Chinmay

  • Posted 14 February 2018, 5:03 pm EST

    Hi Manish,

    My last post got marked as answer, can you please revert for the questions in it?

    Regards,

    Chinmay

  • Posted 19 February 2018, 12:52 am EST

    Hi Chinmay,

    Please find the updated fiddle.

    http://jsfiddle.net/yf9o4hy2/15/

    ~nilay

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels