• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login

    Custom widget - dynamic images on dashboard

    Scheduled Pinned Locked Moved Dashboard
    scriptdashboardcustom widgetjavascripttemplate
    1 Posts 1 Posters 1.4k 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.
    • jkandasaJ Offline
      jkandasa
      last edited by jkandasa

      There is a request on https://github.com/mycontroller-org/mycontroller/issues/405 to show dynamic images on dashboard.

      We can achieve this by using the custom widget.

      Create an HTML template as follows, replace this url with your actual URL.

      <div>
          <img  ng-src="https://static.pexels.com/photos/2487${dynamicImage}/pexels-photo-2487${dynamicImage}.jpeg" alt="test image" class="adf-myc-dsi-image"/>
      </div>
      

      Create a javascript as follows, Use UIDTag to map your Custom >> VAR1 senor variable

      var myImports = new JavaImporter(java.io, java.lang, java.util, java.text);
      
      with(myImports) {
        //var dynamicImage = mcApi.uidTag().getByUid("image-var1").getResource();
        var dynamicImage = 98;
      }
      

      Add your HTML template and script on dashboard with custom widget,
      image

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      0

      Online

      587

      Users

      529

      Topics

      3.4k

      Posts
      Copyright © 2015-2025 MyController.org | Contributors | Localization