Commit 01de0476 by NGO THI HONG

Add sort select operation list

parent 7e653b8b
...@@ -73,6 +73,14 @@ OperationSelect.init = function (selectedCallback) { ...@@ -73,6 +73,14 @@ OperationSelect.init = function (selectedCallback) {
*/ */
OperationSelect.createOperationSelectList = function (operationList) { OperationSelect.createOperationSelectList = function (operationList) {
$('#operationSelectList').empty(); $('#operationSelectList').empty();
// sort operation list by operationId
operationList = operationList.sort(function (a, b) {
if (a.operationId < b.operationId) return 1;
if (a.operationId > b.operationId) return -1;
return 0;
});
if (typeof operationList === 'undefined' || operationList.length < 1) return; if (typeof operationList === 'undefined' || operationList.length < 1) return;
for (let i = 0; i < operationList.length; i++) { for (let i = 0; i < operationList.length; i++) {
let messageli = $("<li class='card mb-2' name = 'operationId_" + operationList[i].operationId + "' ></li>"); let messageli = $("<li class='card mb-2' name = 'operationId_" + operationList[i].operationId + "' ></li>");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment