cliftonc/calipso

Calipso menu weight error

Closed this issue · 1 comments

Hi
I am using the calipso crm, it is kool

when i set the menu weight = 0, the menu sort isn't run.

after i change the code,like this:

 self.sortedChildren.sort(function (a, b) {

    // a & b are strings, but both objects on the current children
    var diff;
   if (self.sort in self.children && self.sort in self.children[b] { // changed by jc
   // if (self.children[a][self.sort] && self.children[b][self.sort]) {

      if (typeof self.children[a][self.sort] === "string") {
        diff = self.children[a][self.sort].toLowerCase() > self.children[b][self.sort].toLowerCase();
      } else {
        diff = self.children[a][self.sort] > self.children[b][self.sort];
      }

    } else {
      diff = self.children[a].name.toLowerCase() > self.children[b].name.toLowerCase();
    }

    return diff;
  });

everything go well.

another issue, how can i redirect to other route within request route cycle?

Best Regards:

Looks like there is a typo in your code...
I added the text formatting escape to read it better but it looks like the code should be

if (self.sort in self.children[a] && self.sort in self.children[b] { // changed by jc

rather than

if (self.sort in self.children && self.sort in self.children[b] { // changed by jc

which is the code in your snippet.