How to render the column with custom data?

Modified on Thu, 7 Apr, 2022 at 12:44 AM

Sometimes you may need to add a special column, that render some complex data. E.g. in this case we want to show Requirements linked to Mitigation Tasks



You can do it by special column, with content being prepared on the server with a embedded velocity script.

See the "serverRender" property.

{
            "headerGroup":"Mitigations",
            "headerGroupCss":"headMitigations",
            "headerCss":"headMitigations",
            "header": "Requirements",
            "bindings": "task.$item",
            "width": 170    ,
            "serverRender": "<ul style='margin-block-start: -16px;margin-block-end: -16px;padding-inline-start: 16px;'>#foreach($l in $item.fields().linkedWorkItems().back()) #set($r = $l.fields().workItem().get()) #set($t = $r.fields().type().get().id()) #if($t.equals(\"requirement\")) <li> $r.render().withTitle().withIcon(false).withLinks().htmlFor().forFrame() ($r.fields().description().render().htmlFor().forFrame()) </li>  #end #end</ul>"
                      
        },


The main access point in the script is $item. By default $item correspond to RowItem (i.e. Risk), but you can instruct

the system to consider as $item the downstream object, with using binding:"task.$item" or better $ DOWNSTREAM_OBJECT_ID . item.  Or for upstream objects you can use the same, e.g. harm.$item as a binding.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article