How to refresh or reload the relationship tab

オフライン

Hi, All.
I have a Itemtype (source) named DocApply.
DocApply has a relationship called DocApply_deplist which connects DocApply to DocApply_dep (related).
I added an onchange event to DocApply's property (no) to bring the related data to DocApply_dep when (no) is changed.
The problem I encounter now is as follows

DocApply_dep has a field with the dep_name data type of Item
When I successfully write the data into DocApply_dep, but the dep_name of the relationship tab on the screen is blank, I want her label to be displayed, but I don't know how to do it, can anyone suggest me?

//Here is the javascript code I wrote
//It is executed in (docapply.no) onchange event

var tabbar = parent.relationships.relTabbar;
      tabID = tabbar.GetTabId("部門會簽");
var currTabID = parent.relationships.currTabID;
var FirstTabID = tabbar.GetTabId("Signoffs");

var tmpItem;
var DocApply_depRelId = top.aras.getItemFromServerByName("RelationshipType","DocApply_deplist","id").node.getAttribute('id');

var dep = "gm,ap,ep,sw,rd,hpla,po,ee,pa,cm,ed,lm,tt,pt,ad_mm,qc,ms_1,it,ad,hr,fa,fc"

if (srcElement.value !== "")
{
   var qcondition = "<itemtype>Arima_ECR_ECN</itemtype><id>"+ECNid+"</id><dep>"+dep+"</dep>";
   var Depinfo = top.aras.applyMethod("Find_Old_CountersignDep", qcondition);
   Depinfo = Depinfo.replace("<Result>","");
   Depinfo = Depinfo.replace("</Result>","");
   //return-> id:keyed_name,id:keyed_name,...

   var Dep_data = Depinfo.split(",");
   for (var i = 0;i<Dep_data.length ; i++)
   {
      var Dep_info = Dep_data[i].split(":");

      tmpItem = top.aras.newItem("DocApply_dep");
      top.aras.itemsCache.addItem(tmpItem);
      top.aras.setItemProperty(tmpItem,"dep_name",Dep_info[0]); // id

      var newRelship = top.aras.newRelationship(DocApply_depRelId,parent.item,false,null,tmpItem,"DocApply_dep",false,true,"DocApply_deplist");
   }

}

if (currTabID !== FirstTabID)
{
   top.document.frames[2].iframesCollection[tabID].contentWindow.location.reload();
}

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

    I also tried the following four ways to update and reload,

    but I don't know if it's the wrong way to use it,

    it didn't work for me either, there will be an error message

    //1.

    //parent.relationships.reload()
    /*

    //2.
    var parentItm = document.thisItem;
    var parentID = document.itemID;
    var parentAction = 'view'; // or 'view'
    top.aras.uiReShowItem(parentID,parentID,parentAction,'部門會簽');
    */
    /*

    //3.
    if (currTabID !== FirstTabID)
    {
       top.relationships.iframesCollection[tabID].contentWindow.location.reload();
    }
    */
    /*

    //4.
    if (aras.getMostTopWindowWithAras(window).frames.relationships)
    {// check "no tabs in tab view"
       var iFramesCollection = aras.getMostTopWindowWithAras(window).frames.relationships.iframesCollection;
       for (var tbId in iFramesCollection)
       {
          var relshipTypeNd = aras.getRelationshipType(tbId);
          var relshipTypeName = aras.getItemProperty(relshipTypeNd.node, "name");
          if(relshipTypeName === "DocApply_deplist") {
             iFramesCollection[tbId].contentWindow.location.reload()
          }
       }
    }
    */

    Can anyone tell me the correct way to use it and the timing?

  • オフライン in reply to Mavis

    Hello,

    Thanks for the update and quick reply. I'll be sure to keep an eye on this thread. Looking for the same issue. Bumped into your thread. Thanks for creating it. Looking forward for solution.

  • オフライン in reply to Michael_08

    hi Michael

    I used try catch to solve this problem...
    I don't think it is a proper solution
    But it can be a reference...

    try
    {
       top.relationships.iframesCollection[tabID].contentWindow.location.reload();
    }
    catch (parent)
    {
    }

  • オフライン in reply to Mavis

    Hi

    You can use below method to refresh particular tab

    if(aras.getMostTopWindowWithAras(window).frames.relationships)
    {
    var iFramesCollection = aras.getMostTopWindowWithAras(window).frames.relationships.iframesCollection;
    for (var tabId in iFramesCollection)
    {
    var relshipTypeNd = aras.getRelationshipType(tabId);
    var relshipTypeName = aras.getItemProperty(relshipTypeNd.node, "name");
    if(relshipTypeName === "SignOffs")
    {
    iFramesCollection[tabId].contentWindow.location.reload();
    }
    }
    }