Collapse tree upon opening project entry

Upon opening a project in project entry the tree with phases, milestones etc. is expanded. This is making it way too cluttered so we always collapse everything before working on the project. Is there a way to have it collapsed upon opening the project by default (preferably via standard settings)?

The way it opens (as you can see, we use a classic form for project entry still):

You’d have to make a customization and I’m not sure it’s worth it with Classic sunset a year away.

1 Like

Below is code used to expand the job tree, I’m guessing you could use something very similar but do CollapseAll vs ExpandAll

// Add using
using System.Reflection;
using Infragistics.Win.UltraWinTree;
 
    private void edvJobHead_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
    {
        // ** Argument Properties and Uses **
        // view.dataView[args.Row]["FieldName"]
        // args.Row, args.Column, args.Sender, args.NotifyType
        // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
        if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
        {
            if ((args.Row > -1))
            {
                Ice.Lib.Framework.JobLib.MethodTree methodTree = default(Ice.Lib.Framework.JobLib.MethodTree);
                FieldInfo fieldInfo = default(FieldInfo);
                Ice.Lib.Framework.JobLib.MethodTreePanel treeviewPanel = default(Ice.Lib.Framework.JobLib.MethodTreePanel);
                fieldInfo = typeof(Erp.UI.App.JobTracker.JobTrackerForm).GetField("jobTreeViewPanel", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance);
                treeviewPanel = (Ice.Lib.Framework.JobLib.MethodTreePanel) fieldInfo.GetValue(JobTrackerForm);
                methodTree = treeviewPanel.MethodTree;
                methodTree.ExpandAll();
            }
        }
    }
 
 
// or Expand FIRST Level nodes only
    private void edvJobHead_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
    {
        // ** Argument Properties and Uses **
        // view.dataView[args.Row]["FieldName"]
        // args.Row, args.Column, args.Sender, args.NotifyType
        // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
        if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
        {
            if ((args.Row > -1))
            {
                Ice.Lib.Framework.JobLib.MethodTree methodTree = default(Ice.Lib.Framework.JobLib.MethodTree);
                FieldInfo fieldInfo = default(FieldInfo);
                Ice.Lib.Framework.JobLib.MethodTreePanel treeviewPanel = default(Ice.Lib.Framework.JobLib.MethodTreePanel);
                fieldInfo = typeof(Erp.UI.App.JobTracker.JobTrackerForm).GetField("jobTreeViewPanel", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance);
                treeviewPanel = (Ice.Lib.Framework.JobLib.MethodTreePanel) fieldInfo.GetValue(JobTrackerForm);
                methodTree = treeviewPanel.MethodTree;
                foreach ( UltraTreeNode rootNode in methodTree.Nodes )
                    IterateNodes( rootNode );
            }
        }
    }
 
    private void IterateNodes ( UltraTreeNode node )
    {
        foreach ( UltraTreeNode childNode in node.Nodes )
        {
            if (childNode.ToString() == "Operations")
                {
                    childNode.ExpandAll();
                }
            IterateNodes ( childNode );
        }
    }
2 Likes

I was searching the files for the code to do that. Beat me too it but glad you posted it.

Aah, that’s what I feared. Thanks for the quick reply guys!