Tree Grid View (TGV): How I can render a cell as an icon/image?

Hello,

I have a question regarding the TreeGridview.

We need to set different row icons on a TreeGridView based on a ItemType property called kind of "xx_type".

We already have a TreeGridview that uses the ItemType icons but they are too generic and we need to replace them
based on a property called "xx_type".

I am thinking of 2 possibilities:

1. Render a new cell as an icon/image. Is it possible? As I see, the designer doesn't offer this possibility.
2. Replace the existing Icons dynamically using a client method. Is there a possibility to do that?

I would prefer 1'st option,I think second option is by far most complicated.

If somebody knows and can help I would really appreciate that.

Thank you.

  • Are you able to add the same Item to the tree multiple times (once for each "xx_type"), using a property filter and a custom Icon?

    It may not be elegant, but could give you the result you are trying to achieve.

    Many thanks,
    Martin

  • Adding a second image column is theoretically possible but not easy to do. You would have to duplicate the item indicatior column.

    Another approach may be the modification of the column mapping in the Column definition. By default, it´s set to a static icon. But you could manually change it to a property that contains the new icon:

  • Thank you, I was unaware you could use an image property on the item as the Icon in tree grid.  I have managed to get somewhere close by creating an image column which can then be used as the icon which I populate in advance of running the query. 

    Can you create the image dynamically at run time? I.e. if you don't know the property until the query is run. Such as a Part BOM, where you don't know if a part is a parent or a child until the context item is passed to the query.

  • Did you make an extra column or did you overwrite the standard ItemType indicators? In my few quick tests I only used static codetree images. The Method rb_DefaultColumnBuilderMethod is used for the rendering, maybe this one is a good start for further investigations.