You need to sign in to do that
Don't have an account?
Balu Phrabha123
Add Dollar $ to the data table list.
HI All,
For the data table i need to show the "$" in front of Revenue.
Example: $98574.87M
{ label: 'Revenue', sortDirection: 'desc' ,sortable: true, initialWidth:120, fieldName: 'prospectRevenue', type: 'text'},
{ label: 'Industry', sortable: false, fieldName: 'naics6Description', type: 'text'},
{ label: 'City', sortable: true, fieldName: 'city', initialWidth:120, type: 'text'},
{ label: 'Zip', sortable: true, fieldName: 'postalCode', initialWidth:80, type: 'text'},
{ label: 'HQ', sortable: true, fieldName: 'headquarter', initialWidth:80, type: 'text'}
for showing revenue logic. Please see below code for reference.
.JS
// Revenue logic
jsresult.prospectSummary.forEach(function(record){
if(record.prospectRevenue){
record.prospectRevenue = Math.round(Math.abs(Number(record.prospectRevenue)) / 1.0e+6 *100)/100 + "M";
console.log('Revenue in Millions', record.prospectRevenue);
}
Regards,
Balu
For the data table i need to show the "$" in front of Revenue.
Example: $98574.87M
{ label: 'Revenue', sortDirection: 'desc' ,sortable: true, initialWidth:120, fieldName: 'prospectRevenue', type: 'text'},
{ label: 'Industry', sortable: false, fieldName: 'naics6Description', type: 'text'},
{ label: 'City', sortable: true, fieldName: 'city', initialWidth:120, type: 'text'},
{ label: 'Zip', sortable: true, fieldName: 'postalCode', initialWidth:80, type: 'text'},
{ label: 'HQ', sortable: true, fieldName: 'headquarter', initialWidth:80, type: 'text'}
for showing revenue logic. Please see below code for reference.
.JS
// Revenue logic
jsresult.prospectSummary.forEach(function(record){
if(record.prospectRevenue){
record.prospectRevenue = Math.round(Math.abs(Number(record.prospectRevenue)) / 1.0e+6 *100)/100 + "M";
console.log('Revenue in Millions', record.prospectRevenue);
}
Regards,
Balu
Let me know, if I managed to help you that way?
Regards,
Jonathan
1. As Jon mentioned, type currency should work (I have a similar component and it is working), if you just want to dispaly something linke '$1,000,000.00'. If you cannot see the data, please make sure the Revenue is defined a decimal type in your apex controller.
2. JS might not work as you are trying to modify on data through wired service.
3. If you want to see something like '$3.5M', then you have to create a string field (let's call it RevenueString) and format it before it is called by LWC wired service.
1. Assume the lightning-datatable is binding to property @track data
2. Keep reveneu column type as 'text'
3. in your wired service method