Angularjs ag网格中的货币格式
浮点数需要格式化并显示在网格中。例123456567.82。来自后端的数据是1234567.82。如何在ag网格中格式化,并具有排序、过滤等其他功能。我确实在堆栈溢出中找到了一个链接来使用Math。floor num.tostring并应用一些正则表达式,但这会截断小数点而不可排序 价格={价格|货币} var-app=angular.module'myApp',[]; 应用程序控制器'costCtrl',函数$scope{ $scope.price=123456567.82; }; 货币过滤器将数字格式化为货币格式Angularjs ag网格中的货币格式,angularjs,floating-point,ag-grid,Angularjs,Floating Point,Ag Grid,浮点数需要格式化并显示在网格中。例123456567.82。来自后端的数据是1234567.82。如何在ag网格中格式化,并具有排序、过滤等其他功能。我确实在堆栈溢出中找到了一个链接来使用Math。floor num.tostring并应用一些正则表达式,但这会截断小数点而不可排序 价格={价格|货币} var-app=angular.module'myApp',[]; 应用程序控制器'costCtrl',函数$scope{ $scope.price=123456567.82; }; 货币过滤
你能在plunker中发布一个工作示例吗?你能添加一些解释让大家更容易理解你的答案吗?
CellRendererUSD(params: any) {
var inrFormat = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2
});
return inrFormat.format(params.value);
}
columnDefs = [
{ headerName: 'A/c No', field: 'accountNo', width: 100 },
{ headerName: 'A/c Name', field: 'accountName' },
{ headerName: 'NAV', field: 'nav', cellRenderer: this.CellRendererUSD }
];
rowData = [
{ accountNo: '4', accountName: 'Janhavee', nav: 10000.49 },
{ accountNo: '5', accountName: 'Vignesh', nav: 100000.50 },
{ accountNo: '6', accountName: 'Upesh', nav: 1000000.51 }
];