So you want to render some more data on the Gantt?
For example:
Consider you have a Work item of type Epic and you want to render Owner field to the right of the task
To do so, you need to things:
- Prepare the data
- Configure how to render the data
Prepare the data
To prepare the data you use the Advanced > Item Script parameter, and put the following snippet there:
if(wi.type.id==='epic'){ var o = wi.getValue("owner"); if(o!=null){ task.getFields().put("owner",o.getName()); } }
You see, it is simple, you can keep passing any additional data using task.getFields().put(KEY,VALUE)
Configure how to render the data
Now, let's set the template to render the right side text via, you can do it via Advanced > Gantt Config Script widget parameter. Put the following snippet there:
gantt.templates.rightside_text = function(start, end, task){ return (task.fields.owner?"Owner: <b>"+task.fields.owner+"</b>":""); };
That's it. Not the Gantt will render an Owner to the right to the task.
What else you can render? If you want to render the "assignee" field, use the following Item Script
if(wi.type.id==='portfolioepic'){ var aIt = wi.getAssignees().iterator(); var assignees = ""; var separator = ""; while(aIt.hasNext()){ var assignee = aIt.next(); assignees = assignees + separator + assignee.name; separator = ","; } if(assignees!=""){ task.getFields().put("assignees",assignees); } }
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article