change the sorting method of rpc name to natural sorting

This commit is contained in:
MaysWind 2018-09-02 21:29:41 +08:00
parent 4be5492676
commit 7f81e9c07e
3 changed files with 3 additions and 7 deletions

View file

@ -15,6 +15,7 @@
"awesome-bootstrap-checkbox": "^0.3.7", "awesome-bootstrap-checkbox": "^0.3.7",
"jquery-slimscroll": "^1.3.8", "jquery-slimscroll": "^1.3.8",
"bootstrap-contextmenu": "^1.0.0", "bootstrap-contextmenu": "^1.0.0",
"natural-compare": "1.4.0",
"angular": "1.6.10", "angular": "1.6.10",
"angular-route": "1.6.10", "angular-route": "1.6.10",
"angular-sanitize": "1.6.10", "angular-sanitize": "1.6.10",

View file

@ -329,6 +329,7 @@
<script src="../node_modules/jquery-slimscroll/jquery.slimscroll.min.js"></script> <script src="../node_modules/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<script src="../node_modules/sweetalert/dist/sweetalert.min.js"></script> <script src="../node_modules/sweetalert/dist/sweetalert.min.js"></script>
<script src="../node_modules/bootstrap-contextmenu/bootstrap-contextmenu.js"></script> <script src="../node_modules/bootstrap-contextmenu/bootstrap-contextmenu.js"></script>
<script src="../node_modules/natural-compare/index.js"></script>
<script src="../node_modules/angular-translate/dist/angular-translate.min.js"></script> <script src="../node_modules/angular-translate/dist/angular-translate.min.js"></script>
<script src="../node_modules/angular-moment/angular-moment.min.js"></script> <script src="../node_modules/angular-moment/angular-moment.min.js"></script>
<script src="../node_modules/angular-websocket/dist/angular-websocket.min.js"></script> <script src="../node_modules/angular-websocket/dist/angular-websocket.min.js"></script>

View file

@ -245,13 +245,7 @@
// Do Nothing // Do Nothing
} else if (displayOrder === 'rpcAlias') { } else if (displayOrder === 'rpcAlias') {
result.sort(function (rpc1, rpc2) { result.sort(function (rpc1, rpc2) {
if (rpc1.rpcAlias < rpc2.rpcAlias) { return String.naturalCompare(rpc1.rpcAlias, rpc2.rpcAlias);
return -1;
} else if (rpc1.rpcAlias > rpc2.rpcAlias) {
return 1;
} else {
return 0;
}
}); });
} }