Enums image on tree view

2
Is there any other way to display an Enum Image on treeview I have tried everything in the Redering Display mode but still doesnt display the image
asked
2 answers
1

Sadly, enumeration images are not supported by custom widgets. You could lookup the url of your enum images and put that (relative) url in a string attribute to display the image.

answered
1

Happily there is....in a kind of 'round about' way of working....

Here is how it works.

Let's say I want a tree in which items have a checkbox that can be 'ticked' or 'unticked'.

  • Create two images of an checkbox: 'ticked.png' and 'unticked.png'
  • Add these images to the image collection of YourModule (or whatever module...)
  • Create an enum with values 'ticked' and 'unticked' and attach the created images to the enum for use in non-treeview screens
  • Create an object TreeItem (or whatever object) and add two attributes:
    1. enumval (the defined enum)
    2. picturepath (string)
  • Create a microflow to manipulate the enum value. For instance a 'toggle microflow' with which you can toggle the value of the enum. But here is the trick: At the moment you set the value of the enum you also manipulate the attribute TreeItem.picturepath and set it to:

'img/YourModule$ticked.png' (or whatever picture name you use)

  • In the treeview add the Treeview.picturepath to the rendered items
  • Set the rendering mode on 'show as picture'
  • If you want to tick/untick the checkbox in the tree itself, add an event that calls the 'toggle microflow' (don't forget the cacheburst of the parent item...)

Thats it...

answered