Advertisement
Guest User

Untitled

a guest
May 28th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Instruments.prototype.sortInstruments = function (sortParam, desc) {
  2.         var sortInstruments;
  3.         if (!desc) {
  4.             sortInstruments = _.sortBy(this.instruments.value, function (instrument) {
  5.                 return instrument[sortParam];
  6.             });
  7.         } else {
  8.             sortInstruments = _.sortBy(this.instruments.value, function (instrument) {
  9.                 return instrument[sortParam];
  10.             }).reverse();
  11.         }
  12.         this.instruments.value = sortInstruments;
  13.     };
  14.  
  15.     Instruments.prototype.headClickCallback = function (id) {
  16.         var desc;
  17.         if (this.lastSortParam === id) {
  18.             desc = true;
  19.             this.lastSortParam = '';
  20.         } else {
  21.             desc = false;
  22.             this.lastSortParam = id;
  23.         }
  24.         this.sortParam = id;
  25.         this.sortInstruments(id, desc);
  26.         this.setMode(this.currentMode);
  27.         this.refreshPortfolioHoldings();
  28.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement