You need to sign in to do that
Don't have an account?
Matt Eck 15
JS .sort not working in Lighting Web Component
Hey all,
I am currently trying out Lighting Web Components and have been stuck on the same issue for a while now. I have a Wrapper class (progWrap) with a list of another Wrapper class (progList) as one of it's attributes. I want to sort that list using an attribute from the wapper class making up progList.
To do so I want to use JS .sort and my current sort method looks like this:
All I want to do is assign this.progWrap.progList = sortList; but everytime I do I get this error:
['set' on proxy: trap returned falsish for property 'progList']
What does this mean, and how can I prevent this?
I am currently trying out Lighting Web Components and have been stuck on the same issue for a while now. I have a Wrapper class (progWrap) with a list of another Wrapper class (progList) as one of it's attributes. I want to sort that list using an attribute from the wapper class making up progList.
To do so I want to use JS .sort and my current sort method looks like this:
let sortList = this.progWrap.progList.slice(); console.log(JSON.stringify(sortList)); sortList.sort(function(a,b){ if(a.programCountry < b.programCountry){ return -1; } if(a.programCountry > b.programCountry){ return 1; } return 0 }); console.log(JSON.stringify(sortList));I know this sort is working correctly because I checked it using the console.logs.
All I want to do is assign this.progWrap.progList = sortList; but everytime I do I get this error:
['set' on proxy: trap returned falsish for property 'progList']
What does this mean, and how can I prevent this?
I am also calling the sort function from a button click.