Cell Level Decimal Place

Dear Team,

Our requirement mange cell level decimalplaces.

Example:

Quantity    Amount

20.22         10.506

50.333       2.1

523.4555   566.22222


1 Reply

PS Pavithra Subramaniyam Syncfusion Team May 9, 2022 03:09 PM UTC

Hi Nagendra Gupta,


Thanks for contacting Syncfusion support.


You can achieve your requirement by using the “valueAccessor” method of Grid columns. Inside this method you will get the current row and column details and based on your condition, you can format the data and return it to display in the cells. Please refer to the below code example, documentation, and sample link for more information.


 <e-column field="Freight" width="120" textAlign="Right" [valueAccessor]="valueAccess"></e-column>

 

 

 public valueAccess = (field: string, data1: object, column: object) => {

  const fmt: string = data1['OrderID'] % 2 ? 'N2' : 'N3';

  let formattedString: string = this.intl.formatNumber(data1[field], {

    format: fmt,

  });

  return formattedString;

};

 



Documentation: https://ej2.syncfusion.com/angular/documentation/grid/columns/columns/#valueaccessor


Sample               : https://stackblitz.com/edit/angular-xdaj1l?file=app.component.html,app.component.ts


Please get back to us if you need further as on this.


Regards,

Pavithra S




Loader.
Up arrow icon