Navigation

    MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    Hide module based on content | MMM-AfterShip

    Troubleshooting
    1
    1
    26
    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.
    • P
      PH1TCH last edited by

      Hi everyone, I would like to hide the AfterShip module once there are no active deliveries to be tracked.

      As far as I can tell, the existing code already checks for a certain threshold of maximum allowed trackings at the same time:

      for (var t in this.shipments) {
      	var shipments = this.shipments[t];
      						
      	displayedParcels++;
      		if (displayedParcels > this.config.maximumEntries){
      				break;
      		}
      
      		var row = document.createElement("tr");
      		table.appendChild(row);
      
      ...
      }
      

      I thought of something like this to check for the number of active deliveries and hide the module if there are none:

      for (var t in this.shipments) {
      	var shipments = this.shipments[t];
      						
      	displayedParcels++;
      		if (displayedParcels > this.config.maximumEntries){
      				break
      		} else if (displayedParcels = 0 ){
      				this.hide()
      		} else {
      				this.show()
      		} 
      
      		var row = document.createElement("tr");
      		table.appendChild(row);
      
      ...
      }			
      

      Unfortunately this does not work. Any ideas how to hide a module based on the content?

      Many thanks in advance!

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Enjoying MagicMirror? Please consider a donation!
      MagicMirror created by Michael Teeuw.
      Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
      This forum is using NodeBB as its core | Contributors
      Contact | Privacy Policy