MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

Hide module based on content | MMM-AfterShip



  • 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!


Log in to reply