Explorar el Código

Checkboxes for ingredients now working.

Lee Morgan hace 6 años
padre
commit
3dc95333a1
Se han modificado 1 ficheros con 11 adiciones y 1 borrados
  1. 11 1
      views/dataPage/ingredient.js

+ 11 - 1
views/dataPage/ingredient.js

@@ -45,7 +45,17 @@ window.ingredientObj = {
         }
 
         if(ingredient){
-            this.graph.addData(this.formatData("ingredient", ingredient.id));
+            this.graph.data = [];
+            this.graph.drawGraph();
+            this.graph.addData(this.formatData(type, ingredient.id));
+
+            for(let label of document.querySelector("#ingredientOptions").children){
+                if(label.innerText === ingredient.name){
+                    label.children[0].checked = true;
+                }else{
+                    label.children[0].checked = false;
+                }
+            }
         }
     },