MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-MealViewer

    Scheduled Pinned Locked Moved Development
    48 Posts 6 Posters 26.4k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Mykle1M Offline
      Mykle1 Project Sponsor Module Developer @cowboysdude
      last edited by

      @cowboysdude

      0_1550373395899_dr-evil-austin-said-no-memes.jpg

      Create a working config
      How to add modules

      1 Reply Last reply Reply Quote 1
      • cowboysdudeC Offline
        cowboysdude Module Developer
        last edited by

        0_1550373561202_ce2edd1dff108fb3e574a62c4ab35f39.jpg

        1 Reply Last reply Reply Quote 0
        • K Offline
          kazanjig
          last edited by

          .@cowboysdude was exceptionally helpful last night.
          thumbs up

          1 Reply Last reply Reply Quote 1
          • S Do not disturb
            sdetweil
            last edited by

            Behave boys! Lol

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            cowboysdudeC 1 Reply Last reply Reply Quote 1
            • cowboysdudeC Offline
              cowboysdude Module Developer @sdetweil
              last edited by

              @sdetweil said in MMM-MealViewer:

              Behave boys! Lol

              @sdetweil said in MMM-MealViewer:

              Behave boys! Lol

              We try VERY hard LOL

              1 Reply Last reply Reply Quote 0
              • K Offline
                kazanjig
                last edited by kazanjig

                But now I seem to have gotten myself into a pickle. I tried expanding the functionality to add a date range and multiple schools and, of course, I broke it. It’s doing the same thing as before where the ‘cafeteriaLineList’ property is stripped out of the helper results…

                EDIT:
                LOL, it’s the weekend and I had it pulling just for today, Sunday. Of course there’s no data. Dumb da dumb dumb…

                1 Reply Last reply Reply Quote 0
                • cowboysdudeC Offline
                  cowboysdude Module Developer
                  last edited by

                  @kazanjig said in MMM-MealViewer:

                  cafeteriaLineList

                  Probably not stripped out just buried like many of the other things were LOL If you don’t get it we can look at it later if you want.

                  S K 2 Replies Last reply Reply Quote 0
                  • S Do not disturb
                    sdetweil @cowboysdude
                    last edited by

                    @cowboysdude you did convert the XML to json, right?

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    cowboysdudeC 1 Reply Last reply Reply Quote 0
                    • cowboysdudeC Offline
                      cowboysdude Module Developer @sdetweil
                      last edited by

                      @sdetweil Yes I did … it’s all coming back as json but it has a TON of data…

                      1 Reply Last reply Reply Quote 0
                      • K Offline
                        kazanjig @cowboysdude
                        last edited by kazanjig

                        MAJOR EDIT, MAJOR DUMMIE: helps if you append the rows to the table… Success! Now for some CSS.

                        @cowboysdude I edited my earlier post… minor detail about it being the weekend and not being able to pull lunch data for a day with no school. Now just having getting the data to show up in the table…

                        It will display the “loading” message, but then it’s blank when this.loaded = true. I outputted the innerHTML values to console and they’re all there. Not sure why they won’t show up in the DOM.

                          getDom: function() {
                            // Set up the local wrapper
                            var wrapper = null;
                        
                            // If we have some data to display then build the results table
                            if (this.loaded) {
                              wrapper = document.createElement("table");
                        
                              // Iterate through the schools
                              for (var i = 0; i < this.results.length; i++) {
                        
                                // Set up header row with the school name
                                schoolRow = document.createElement("tr");
                        
                                schoolName = document.createElement("td");
                                schoolName.innerHTML = this.results[i].physicalLocation.name;
                        
                                schoolRow.appendChild(schoolName);
                        
                                // Iterate through the cafeteria lines for the school
                                for (var j = 0; j < this.results[i].menuSchedules[0].menuBlocks[0].cafeteriaLineList.data.length; j++) {
                        
                                  // 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;
                        
                                  cafeteriaLineRow.appendChild(cafeteriaLineName);
                        
                                  // 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++) {
                        
                                    foodItemRow = document.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;
                        
                                    foodItemRow.appendChild(foodItemType);
                                    foodItemRow.appendChild(foodItemName);
                                  }
                                }
                              }
                            }
                        
                            else {
                              // Otherwise lets just use a simple div
                              wrapper = document.createElement('div');
                              wrapper.innerHTML = 'Loading menu data...';
                            }
                        
                            return wrapper;
                          },
                        
                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 5
                        • 1 / 5
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy