Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9067

Re: How to custom sort a list dynamically ?

$
0
0

var map = {"Very High" : 1, "High" : 2, "Medium" : 3, "Low" : 4};

 

 

function get(k){

  return map[k];

}

 

 

var oSorter = new sap.ui.model.Sorter("Priority");

oSorter.fnCompare = function(value1, value2) {

  var val1Mapped = get(value1);

  var val2Mapped = get(value2);

    if (val1Mapped < val2Mapped) return -1;

    if (val1Mapped == val2Mapped) return 0;

    if (val1Mapped > val2Mapped) return 1;

};


Viewing all articles
Browse latest Browse all 9067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>