MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. kazanjig
    3. Best
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 7
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: MMM-MealViewer

      .@cowboysdude was exceptionally helpful last night.
      thumbs up

      posted in Development
      K
      kazanjig
    • RE: MMM-MealViewer

      So I now get the following table:

      Elementary Lunch
      Entree “Bold” Cheese Pizza
      Entree “Bold” Pepperoni Pizza
      Vegetable Parmesan Butternut Gratin
      Vegetable Seasoned Green Beans
      Elementary Alternative
      Entree Chef Salad
      Entree Bologna & Cheese Sandwich

      The foodItemType in the first column and the foodItemName in the second column are siblings in the data array.

      I’d like turn the first occurrence of foodItemType into a category so the table looks like this (ignore the spacing hyphens):

      Elementary Lunch
      Entree “Bold” Cheese Pizza
      --------------“Bold” Pepperoni Pizza
      Vegetable Parmesan Butternut Gratin
      -------------------Seasoned Green Beans
      Elementary Alternative
      Entree Chef Salad
      -------------Bologna & Cheese Sandwich

      Here’s the current loop that creates the table. Any help would be appreciated.

              // Iterate through the cafeteria lines for the school
              for (var j = 0; j < this.results[i].menuSchedules[0].menuBlocks[0].cafeteriaLineList.data.length; j++) {
      
                if (this.results[i].menuSchedules[0].menuBlocks[0].cafeteriaLineList.data[j].name !== 'Elmwood Vegetarian Hot Entree') {
      
                  // Set up header row with the cafeteria line name
                  cafeteriaLineRow = document.createElement("tr");
      
                  cafeteriaLineName = document.createElement("td");
                  cafeteriaLineName.innerHTML = this.results[i].menuSchedules[0].menuBlocks[0].cafeteriaLineList.data[j].name.replace("Elmwood Elementary", "Elementary Lunch").replace("Elmwood Alternative", "Elementary Alternative");
                  cafeteriaLineRow.appendChild(cafeteriaLineName);
                  wrapper.appendChild(cafeteriaLineRow);
      
                  // Iterate through the menu items for the cafeteria line
                  for (var k = 0; k < this.results[i].menuSchedules[0].menuBlocks[0].cafeteriaLineList.data[j].foodItemList.data.length; k++) {
      
                    if (this.results[i].menuSchedules[0].menuBlocks[0].cafeteriaLineList.data[j].foodItemList.data[k].item_Name !== 'Choice Of:') {
      
                      foodItemTypeRow = documen t.createElement("tr");
      
                      foodItemType = document.createElement("td");
                      foodItemType.innerHTML = this.results[i].menuSchedules[0].menuBlocks[0].cafeteriaLineList.data[j].foodItemList.data[k].item_Type;
      
                      foodItemName = document.createElement("td");
                      foodItemName.innerHTML = this.results[i].menuSchedules[0].menuBlocks[0].cafeteriaLineList.data[j].foodItemList.data[k].item_Name;
      
                      foodItemTypeRow.appendChild(foodItemType);
                      wrapper.appendChild(foodItemTypeRow);
                      foodItemTypeRow.appendChild(foodItemName);
                      wrapper.appendChild(foodItemTypeRow);
                    }
                  }
                }
              }
      
      posted in Development
      K
      kazanjig
    • RE: Conditional formatting of config (e.g., MMM-Unsplash)

      @seann good point, I could just put the collections directly in the module rather than the config, that would do it. @parnic suggested using profile switcher, or at least there may be functionality to grab. I should be able to take it from here – pretty simple. The most time-consuming part will be creating the collection of collections.

      posted in Development
      K
      kazanjig
    • 1 / 1