Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 818107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:05:57+00:00 2026-05-15T02:05:57+00:00

I have created a tree containing information about server and its VMs. I want

  • 0

I have created a tree containing information about server and its VMs.
I want to change the icon of VM to green if the VM is power on or to red if the VM is poweroff.
How to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:05:58+00:00Added an answer on May 15, 2026 at 2:05 am

    Create a function to switch the tree node css class depending on if the VM is on or off.

    ar iconFunc = dojo.hitch(this, function (item, opened) { 
                    if(item !== undefined && item !== null) {
                        if (item.VmOn!== undefined) {
                            return "VmOn";
                        }
                        else {
                            return "VmOff";
                        }
                    }
                });
    

    When creating your tree, pass the iconFunc in the constructor params:

    var treeParams = {
        getIconClass : iconFunc, //attach the custom icon function
    ...};
    var myTree = new dijit.Tree(treeParams);
    

    Then create css styles called VmOn and VmOff:

    .VmOn {
        background: url(path to your image for VmOn) no-repeat;
    

    The store items that make up the tree nodes will need a property of VmOn or VmOff or change the iconFunc to examine the store items in a different way…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a new project I have created a local folder tree with empty Visual
I have a binary tree class that is created with a root node and
I have two tree, which contains nodes, after I've created them, I take all
I want to create tree structure using web service. I have used bottom up
I have created a custom tree view control in .NET to display directories. What
I have created a dashboard for an Umbraco site and I want to link
I have created 3 partial classes and i want all of them to be
I have created Tree with more than 1 column using TreeColumn. Right now what
I have web page in ASP.NET. I have created Tree View control with jQuery.
Hey guys, I have created a tree which is not a binary tree. Now,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.