Pārlūkot izejas kodu

Sorting entries in participantOverview

Andrej 1 dienu atpakaļ
vecāks
revīzija
43298bd942
1 mainītis faili ar 7 papildinājumiem un 3 dzēšanām
  1. 7 3
      web/crf/participantOverview.js

+ 7 - 3
web/crf/participantOverview.js

@@ -152,15 +152,19 @@ function(entryMap){
       let tNode=crfHTML.createTextNode(formName,null,cell);
       crfHTML.addStyle(cell,'small');
    }
+   //sort ids
+   labels=Object.keys(entryMap);
+   labels.sort();
 
-   for (let idLabel in entryMap){
+   for (let idCounter=0;idCounter<labels.length;idCounter++){
+      let idLabel=labels[idCounter];
       row=table.insertRow();
       let cell=crfHTML.createTblHeader(null,row);
       crfHTML.createTextNode(idLabel,null,cell);
       cell.onclick=function(){that.openParticipant(idLabel);};
       cell.oncontextmenu=function(){that.openParticipant(idLabel,"_blank");};
-      for (let i=0;i<formRows.length;i++){
-         let form=formRows[i]['Key'];
+      for (let ir=0;ir<formRows.length;ir++){
+         let form=formRows[ir]['Key'];
          let count=new Object();
          if (form in entryMap[idLabel]){
             let ar=entryMap[idLabel][form];