Read the statement by Michael Teeuw here.
Help with updateDom
-
@mumblebaj said in Help with updateDom:
but what I am trying to avoid is that when I start the mirror, all modules stay active on the 1st screen instead of hiding the modules I don’t want active on the 1st screen. I am using MMM-pages for this. Because there is a delay in the data being returned it causes this issue.
Hmmm. I think
hiddenOnStartup
option of the module configuration would be what you really consider. -
https://forum.magicmirror.builders/uid/6639 also. you don’t HAVE to show any content. you can return an empty div and mm is happy
you should also keep track of your hidden state (suspend/resume) and not call uodateDom while hidden… so u won’t generate any content while pages has u hidden
-
@sdetweil The biggest issue is that I need to set arrows based on data being returned. I.e. Arrow will go up depending on the data or it points down based on the data. That is where I am stuck. How do I set those back into the wrapper based on the data.
generateSolarLine: function() { var ppvData = parseInt(this.growattData[0].ppv1) + parseInt(this.growattData[0].ppv2); solarLabel.innerHTML = `Solar: ${ppvData}W`; if(ppvData > 0) { solarLine.classList.add("active"); const solarArrowOut = document.createElement("i"); solarArrowOut.classList.add("arrow", "down", "active"); solarLine.appendChild(solarArrowOut); } else { solarLine.classList.add("dimmed"); } return solarLine; },
Bases on the value of ppvData I am setting which way the arrow points etc. Doing all the work in the getDom gives issues
-
save solarArrowOut as a module instance variable and redo it’s attributes when u need to.
instead of creating it fresh ever timethis means all the stuff around it should be stable too…
-
@sdetweil Thanks Sam. Managed to resolve this. Everything works fine now and plays well with the other modules.