1

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:

<lightning-datatable
   key-field="Name"
   data={sharesData}                  
   columns={columns}>
</lightning-datatable>     

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
this.refreshGrid();

}



    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

5
  • label: 'Available', fieldName: 'Available', type: 'text' Can you try changing the type to number? Commented Mar 11, 2020 at 15:46
  • I updated to number so it displays a 1 where there is a 10.
    – SavvyGoat
    Commented Mar 11, 2020 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
    Commented Mar 11, 2020 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
    Commented Mar 11, 2020 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
    Commented Mar 11, 2020 at 17:17

1 Answer 1

1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .