mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed sorting by description
This commit is contained in:
parent
1416135d86
commit
d9d82e1803
@ -1058,6 +1058,7 @@ var TreeController = {
|
|||||||
$node.addClass("children-loaded");
|
$node.addClass("children-loaded");
|
||||||
},
|
},
|
||||||
success: function(data, textStatus, xhr) {
|
success: function(data, textStatus, xhr) {
|
||||||
|
console.log(data);
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
var $group = $node.children("ul.tree-group");
|
var $group = $node.children("ul.tree-group");
|
||||||
if (
|
if (
|
||||||
@ -1073,7 +1074,22 @@ var TreeController = {
|
|||||||
$node.append($group);
|
$node.append($group);
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(data.tree, function(element) {
|
// Get the main values of the tree.
|
||||||
|
var rawTree = Object.values(data.tree);
|
||||||
|
// Sorting tree by description (services.treeview_services.php).
|
||||||
|
rawTree.sort(function(a, b) {
|
||||||
|
var x = a.description.toLowerCase();
|
||||||
|
var y = b.description.toLowerCase();
|
||||||
|
if (x < y) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (x > y) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
_.each(rawTree, function(element) {
|
||||||
element.jqObject = _processNode($group, element);
|
element.jqObject = _processNode($group, element);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1112,7 +1128,7 @@ var TreeController = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//console.log($node);
|
||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user