function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Balu Phrabha123Balu Phrabha123 

Data table resizing for the column.

HI all,

I need to fix the the width size for zip and HQ. 
User-added image

i am using below code but not working. 
label: 'Zip', sortable: true, fieldName: 'postalCode', width:80, type: 'text'},
{label: 'HQ', sortable: true, fieldName: 'headquarter', width:20, type: 'text'}

Regards,
Azad V
 
Best Answer chosen by Balu Phrabha123
David Zhu 🔥David Zhu 🔥
You may use initialWidth or fixedWidth column property to set the column size.

label: 'Zip', sortable: true, fieldName: 'postalCode', initialWidth:80, type: 'text'},
{label: 'HQ', sortable: true, fieldName: 'headquarter', initialWidth:20, type: 'text'}
 

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Balu,

If you try changing the width:80 from 80 to another number smaller is it working can you check it once.

Regards,
Anutej
 
Balu Phrabha123Balu Phrabha123
tryed but it is not working. when i changed the width sieze to some other values, the width is not changing.
ANUTEJANUTEJ (Salesforce Developers) 
So on checking thee below developer documentation I see that we can give in percentages or in pixels can you try giving the value in pixels and see like 80px.
Balu Phrabha123Balu Phrabha123
it is not working :( 
ANUTEJANUTEJ (Salesforce Developers) 
Can you try posting the code so that I can replicate the same in my dev org.
Nalini ch 6Nalini ch 6
Hello 

It looks like our team of experts can help you resolve this ticket. We have Salesforce global help-desk support and you can log a case and our Customer Success Agents will help you solve this issue. You can also speak to them on live chat. Click on the below link to contact our help-desk. Trust me it is a support service that we are offering for free!

https://jbshelpdesk.secure.force.com

Thanks,
Jarvis SFDC team
David Zhu 🔥David Zhu 🔥
You may use initialWidth or fixedWidth column property to set the column size.

label: 'Zip', sortable: true, fieldName: 'postalCode', initialWidth:80, type: 'text'},
{label: 'HQ', sortable: true, fieldName: 'headquarter', initialWidth:20, type: 'text'}
 
This was selected as the best answer
Balu Phrabha123Balu Phrabha123
Thank you @David Zhu it worked. Really appreciate your help.
Balu Phrabha123Balu Phrabha123
Hey David.

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'}

I need to Show $ symbol for Revenue column

for showing revenue logic. Please see below code for reference.

// 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 
David Zhu 🔥David Zhu 🔥
You can currency type. You can also add currency code as an option.

{ label: 'Revenue', sortDirection: 'desc' ,sortable: true, initialWidth:120, fieldName: 'prospectRevenue', type: 'currency' , typeAttributes: { currencyCode: 'USD'}},,
Balu Phrabha123Balu Phrabha123
but if i change the type to currency i am not seeing data in datatable. I need type:text and should see currency as $ symbol