Folks, I have a LWC data table displaying some aggregate data. It displays every column except for the 'count' column.

Here is my query:

SELECT Location_Share_Configuration__r.Name, Location__r.Name LocationName, Venue__r.Name VenueName, 
                    Period__c, count(Name) Available
                FROM Location_Share__c 
                GROUP BY Location__r.Name, Period__c,Venue__r.Name,Location_Share_Configuration__r.Name

The query returns the data i want.

My LWC and JS code:


export default class MLSE_OppCatalog extends LightningElement {   
    @track columns = [ 
        { label: 'Package Name', fieldName: 'Name', type: 'text'},
        { label: 'Location', fieldName: 'LocationName', type: 'text' },
        { label: 'Venue', fieldName: 'VenueName', type: 'text' },
        { label: 'Period', fieldName: 'Period__c', type: 'text' },
        { label: 'Available', fieldName: 'Available', type: 'text' }        
@wire(getRecord, { recordId: '$recordId', fields})
opportunity({ data, error }) {
//some code before then call refreshGrid


      getShares({ splitType: this.splitType,  brands: this.brands, evtSplit: this.eventSplitType, boxSplit: this.boxSplitType, share: this.shareSize })
            .then(result => {  
                console.log(result );  
                this.sharesData = result;                
            .catch(error => {
                this.error = error;

Below is my result that doesn't display the total at the end. enter image description here

I've changed the 'text' to 'number' for 'availability' in column definitions and this time it displays a 1 where there is a 10. I don't think it's supposed to do that.

enter image description here

  • label: 'Available', fieldName: 'Available', type: 'text' Can you try changing the type to number? – Drew Kennedy Mar 11 '20 at 15:46
  • I updated to number so it displays a 1 where there is a 10. – SavvyGoat Mar 11 '20 at 16:05
  • I feel like the scrollbar is overlapping the last digit based on the data I see. Try resizing the column to the left smaller to see if that reveals the data. You might need to use the initialWidth attribute to make the columns smaller by default. – sfdcfox Mar 11 '20 at 16:41
  • @sfdcfox i modified the initial size and result is the same. Still shows a 1 where there is a 10 and rest are empty. But you are correct the scroll bar is blocking the remaining digits. – SavvyGoat Mar 11 '20 at 17:04
  • When i put my datatable in a DIV tag and set the height it drops in the vertical scrollbar and cuts off the data in the column. Without the scrollbar it displays everything. – SavvyGoat Mar 11 '20 at 17:17

Thanks to @sfdcfox for pointing me in the right direction. I guess the rule of thumb is never but a number column at the end of the table because it aligns it right and hides the remaining digits because of the vertical scroll bar. And now it displays correctly when i moved it over to the left.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.