mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Fixed error with sorting
This commit is contained in:
parent
0860b6e647
commit
34b7c1003b
@ -1077,13 +1077,16 @@ var TreeController = {
|
|||||||
var rawTree = Object.values(data.tree);
|
var rawTree = Object.values(data.tree);
|
||||||
// Sorting tree by description (services.treeview_services.php).
|
// Sorting tree by description (services.treeview_services.php).
|
||||||
rawTree.sort(function(a, b) {
|
rawTree.sort(function(a, b) {
|
||||||
var x = a.elementDescription.toLowerCase();
|
// Only the services are ordered since only they have the elementDescription property.
|
||||||
var y = b.elementDescription.toLowerCase();
|
if (a.elementDescription && b.elementDescription) {
|
||||||
if (x < y) {
|
var x = a.elementDescription.toLowerCase();
|
||||||
return -1;
|
var y = b.elementDescription.toLowerCase();
|
||||||
}
|
if (x < y) {
|
||||||
if (x > y) {
|
return -1;
|
||||||
return 1;
|
}
|
||||||
|
if (x > y) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user