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

    Custom widget - dynamic images on dashboard

    Dashboard
    script dashboard custom widget javascript template
    1
    1
    1213
    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.
    • jkandasa
      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

      647
      Users

      506
      Topics

      3.3k
      Posts

      Copyright © 2015-2023 MyController.org | Contributors | Localization