calling drillDown method results in showing 2 seprate trees

by sangeet.ahuja » Wed Oct 21, 2015 2:59 am

Hi
I am using the SP2013 Org Chart against user profiles. Root Id is empty, and tree starts from top.
Scenario 1 : If I navigate to the Org Chart page, tree starts from the top, which is good.
Scenario 2: We have a staff directory page, which has to be integrated to the Org Chart. I need to show a user selected staff member (in Staff Directory) on Org Chart. I pass on the login id as Query Param which must dictate the current node selection in Org Chart. What I need to achieve is exactly the UI on searching & selecting a member in Org Chart (breadcrumbs, navigate up and down all present).
I use the following code :
renderer.prerenderAction = function(completed){
try {
var targetId=queryString('accountId');
if(targetId){
renderer.drillDown(targetId);
}
}
catch(err) { }
finally {completed();}
}

Problem in scenario 2 : I get 2 distinct Trees. 1 tree for the member/manager I wanted to show and 1 additional for the root node(if set, shows the root node I set, If blank, shows the tree top node). Please check the images. This is not exactly what we need. We need to see just 1 node like when search & select a member.
1.png
1.png (9.94 KiB) Viewed 583 times
2.png
2.png (56.57 KiB) Viewed 583 times
sangeet.ahuja
 
Posts: 4
Joined: Wed Oct 21, 2015 1:48 am

by sangeet.ahuja » Wed Oct 21, 2015 3:32 am

Got the answer myself (I am just so awesome :P )

var isInitialLoad = true;
renderer.onLoadingFinished(function(){
if(isInitialLoad){
isInitialLoad = false;
var targetRootId=queryString('accountId');
if(targetRootId){
renderer.drillDown(targetRootId);
}
}
});

Reference : https://plumsail.com/blog/2015/06/org-c ... y-default/
sangeet.ahuja
 
Posts: 4
Joined: Wed Oct 21, 2015 1:48 am

by Anton Khritonenkov » Wed Oct 21, 2015 9:17 am

Hello,

I'm glad you found the answer. It occurred because of initial loading. you called drill down without waiting for initial loading of Org Chart.
User avatar
Anton Khritonenkov
 
Posts: 219
Joined: Wed Nov 12, 2014 1:33 pm


Return to Org Chart for SharePoint 2013

cron