You need to sign in to do that
Don't have an account?

Sorting a trackable array in Lightning js
Here is the function that receives the trackable array and does the sorting, but it doesn't work.
The console log logs the right value, that works.
Please advise!
sortCityByNumberOfBldgs(province) { console.log(JSON.stringify(this.ab[1].sumchans__City_Stats__r[0].sumchans__Total_Buildings__c)); theData = JSON.stringify(province); theData.sort(function (a, b) { return ((a.sumchans__City_Stats__r[0].sumchans__Total_Buildings__c) - (b.sumchans__City_Stats__r[0].sumchans__Total_Buildings__c)) ? 1 : 0; }) this.ab = theData; }