plantenClass OOP werkt volledig met sample data en if statement fix

This commit is contained in:
Renzo
2024-03-13 13:33:39 +01:00
parent c3ca61f82d
commit ea67ed89e5

View File

@@ -72,10 +72,11 @@ class PlantGrid {
"id": 9,
"plantNaam": "yippie",
"plantensoort": "Groente",
"plantGeteelt": 1
"plantGeteelt": 0
}
];
// Only save objects that have plantGeteelt as 1
const filteredData = dataHardObject.filter(plantObject => plantObject.plantGeteelt === 1);
// Populate the grid with plant objects
@@ -114,7 +115,7 @@ class PlantGrid {
td.appendChild(article);
itemCount++;
} else if (rowIndex === this.rows -1 && colIndex === this.cols -1 & itemCount <= 7) {
} else if (rowIndex === this.rows -1 && colIndex === this.cols -1 && itemCount <= 7) {
// Handle the "Add" button
const article = document.createElement("article");
const img = article.appendChild(document.createElement("img"));