javascript - Sorting not working with Knockout and Isotope -


update: forgot 1 question per question rule. cut second question out of one.

trying make list of users sortable different criteria animation. using knockout this demo seemed direction take. switched isotope 2.0 fork of integration code here.

sometimes sorting doesn't update properly, shown in version - http://codepen.io/matelich/pen/ppoqdz - medal , component should have #0 , #1 switched each other, ui doesn't update.

        switch (content) {            case 'alphabettab':                 viewmodel.users.sort(function (u1, u2) {                   return u1.username.localecompare(u2.username);                });                break;            case 'medaltab':               viewmodel.users.sort(function(u1, u2) {                  return u1.medalscore < u2.medalscore ? 1 : (u1.medalscore > u2.medalscore ? -1 : 0);               });               break;           case 'componenttab':              viewmodel.users.sort(function(u1, u2) {                 return u1.learnedcomponents < u2.learnedcomponents ? 1 : (u1.learnedcomponents > u2.learnedcomponents ? -1 : 0);              });         }         (i = 0; < viewmodel.users().length; i++) {            console.log(viewmodel.users()[i].username);         }         viewmodel.users.valuehasmutated(); 


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

swift - Button on Table View Cell connected to local function -