I would like to compare two lists, if the value of the first list corresponds to the code of the second list, it would be necessary that the second list is sorted according to the values compared
First list :
var List1 = [{id : "idValue2"}, {id : "idValue5"}]
Second List (before sorting)
var List2 = [
{code : "idValue1", label: "value1"},
{code : "idValue2", label: "value2"},
{code : "idValue3", label: "value3"},
{code : "idValue4", label: "value4"};
{code : "idValue5", label: "value5"}]
After comparing list1 ids and list2 codes would get list2 sorted
Second List (after sorting)
var List2 = [
{code : "idValue2", label: "value2"},
{code : "idValue5", label: "value5"}
{code : "idValue1", label: "value1"},
{code : "idValue3", label: "value3"},
{code : "idValue4", label: "value4"}]
Here idValue2 and idValue5 take the first places.
Do you have a solution ?