Ver código fonte

Robustification of the label generation w/r to empty fields and avoiding empty rows warning by applying delete rows only on nonempty arrays

Andrej 2 dias atrás
pai
commit
a30b66b301
1 arquivos alterados com 9 adições e 3 exclusões
  1. 9 3
      web/crf/crfVisitNew.js

+ 9 - 3
web/crf/crfVisitNew.js

@@ -814,7 +814,11 @@ function(entry,field,setup){
       label+=" [";
       for (let i=0;i<dataArray.length;i++){
          if (i) label+="/";
-         label+=dataArray[i].toString();
+         try{
+            label+=dataArray[i].toString();
+         }catch{
+            label+='null';
+         }
       }
       label+="]";
    }
@@ -1290,8 +1294,10 @@ function(queryName,elementId,setup){
       } 
    }
    let modifyEntries=function(data){runQuery.modifyRows(mode,'lists',queryName,[entry],action,cPath);}
-   runQuery.modifyRows('delete','lists',queryName,entries,modifyEntries,cPath);
-   //modifyEntries([]);
+   if (entries.length>0)
+      runQuery.modifyRows('delete','lists',queryName,entries,modifyEntries,cPath);
+   else 
+      modifyEntries([]);
 
 }