• header.categories
    • header.recent
    • header.tags
    • header.popular
    • register
    • login

    Custom widget - dynamic images on dashboard

    scheduled pinned locked moved Dashboard
    scriptdashboardcustom widgetjavascripttemplate
    1 posts 1 posters 1.5k views 1 watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • jkandasaJ offline
      jkandasa
      global: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

      one-reply-to-this-post last-reply-time reply quote 0
      • first-post
        last-post

      0

      online

      644

      users

      532

      topics

      3.4k

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