• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Hide module based on content | MMM-AfterShip

Scheduled Pinned Locked Moved Troubleshooting
1 Posts 1 Posters 182 Views 1 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.
  • P Offline
    PH1TCH
    last edited by Jun 16, 2020, 9:45 PM

    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
    1 / 1
    • First post
      1/1
      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