You need to sign in to do that
Don't have an account?
Sumesh Chandran
Trackable array sorting in Lightning web components
Working on the new Salesforce Lightning web components. I am trying to get the multidimensional array sorted in javascript. I have a trackable array, it has a few columns, i want the data sorted by the total buildings value. Here is what I have done so far, no errors, but not getting the expected results.
Here is the SOQL in the Apex controller:
@track bc = []; @wire(getCityStats) cityStats({ data }) { if (data) { for (let i = 0; i < data.length; i++) { if (data[i].sumchans__Province_Code__c == 'BC') { this.bc.push(data[i]); } } sortCityByNumberOfBldgs(this.bc); } } sortCityByNumberOfBldgs(province) { province.sort(function(a,b) { return a[4]-b[4] }); }
Here is the SOQL in the Apex controller:
SELECT Name,sumchans__Province_Code__c, (select sumchans__Penetration__c,sumchans__Total_Buildings__c from sumchans__City_Stats__r) FROM sumchans__CITY_MASTER__cThis is how the data gets displayed when I run the above query and this is the data that is getting stored in the trackable bc array above.
mod apk download (https://cloneapk.com/) Funimate pro mod apkfunimate mod apk (https://cloneapk.com/funimate-pro-mod-apk/)
https://hindimetro.com/
https://hindigeek.com/
https://mysticmessengeremailguide.com/
https://lyricscentre.com/
@track bc = [];
@wire(getCityStats) cityStats({ data }) {
if (data) {
this.bc = data
.filter(item => item.sumchans__Province_Code__c === 'BC')
.sort((a, b) => a.sumchans__Total_Buildings__c - b.sumchans__Total_Buildings__c);
}
}
This code worked for me when sorting the instagram song download (https://reelssaver.org/) list.