Risksheet Custom Context Menu Actions

Modified on Thu, 19 Sep at 2:36 PM

Imagine you want to add to a context menu an action "Open in Diagram" for every item link column, and also taskLink column.



You put into risksheet_topPanel.vm

<script>
risksheet.customContextMenuActions ={
  "openInDiagramAction":{
      "label":"Open in Diagram", 
      "function":"openInDiagram", 
      "isEnabledFunction":"isOpenInDiagramEnabled"
      }  
  };


function isOpenInDiagramEnabled(item, col){
  console.log("isDoEnabled",item,col)
    return col.type==="itemLink" || col.type==="taskLink";
}


function openInDiagram(item,col){
  let project = risksheet.projectId;
  let linkId=item[col.id]; 
  if(col.type==="taskLink" && linkId.indexOf('!')!=-1){
    const idArray = linkId.split('!');
    project =  idArray[0];
    linkId = idArray[1];
  }
  //replace with real diagram url ....
  window.open(`/polarion/#/project/${project}/workitem?id=${linkId}`)
}

</script>



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