javascript - TableSorter Custom Parser -


I am trying to sort values ​​such as "200.32m" or "800.80b"

Anyone familiar with this method I am using is not working?

  ts.addParser ({id: 'mktcap', is: function (s) {return false;}, format: function (s) {return s.replace (/ m / ssa / 1000000) .replace (/ b /, s + 1000000000);}, type: "numerical"});    

s.replace (/ m / s, + 1000000) looks awkward Try instead for M (and B etc.)

  var s = "200.32m"; S = eval (s.replace (/ m /, "* 1000000")); // s = 200320000 var s = "800.80 B"; S = eval (s.replace (/ b /, "* 1000000000")); // s = 800800000000    

Comments