Job Tracker Expand Tree by default

Is there any way to setup the Job Tracker to expand the job tree by default? or assign the “Expand Tree” function to a hotkey?

Thanks,
DaveO

Using the Form Event Wizard add an EpiViewNotification event using the JobHead view and add to the code script
Change your code to look like this and it will expand the tree by default

// Add using
using System.Reflection;
	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();
			}
		}
	}

CodeLib_10.1.600_JobTrackerForm-AutoExpandMethodTree.xml (6.7 KB)

3 Likes

Mr. Dan: Thank you – I will give that a try.

DaveO

Dave Olender (DaveO)

ERP Specialist

Ph: 651-246-3281

Mr. Dan: I am showing a couple of errors one for fieldinfo and the other for BindingFlags.

Dave Olender (DaveO)

ERP Specialist

Ph: 651-246-3281

I had a couple typos in the code. Try copying it again or import the attached customization on that thread (know that was validated). You need to add the using statement as well (shown in code post)

Mr. Dan: You are a Genius - that works perfectly.

Thank you,
DaveO

This works really well to get the operations to expand, but it does not expand the Subassemblies when I run it. We are running 10.1.600.26. Is this working in your environment?

This customization will only do exactly what you are seeing. I will add an example that includes the subassemblies when I get a chance - which is hopefully today.

Thanks Dan!

Can you use this to only expand certain sections such as ‘Operations’?

You can do something like this to expand the first level operations 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 );
		}
	}

Love it. Thank you!

@danbedwards did you get a chance to create that subassembly example?

I know this is in old thread, but hoping someone is still keeping an eye out. I’ve been able to get the first bit of code to work (automatically expanding everything in the tree view with Job load).

I then added the second bit to expand only the Operations, but am getting an error of

"Compiling Custom Code …

----------errors and warnings------------

Error: CS0246 - line 88 (747) - The type or namespace name ‘UltraTreeNode’ could not be found (are you missing a using directive or an assembly reference?)

** Compile Failed. **
"

Any suggestions?

You’ll need to add following namespace at the top:

using Infragistics.Win.UltraWinTree;

That did the trick. Thank you!!

Any update on a version that works for subassemblies? I can get everything else to expand using the iterate code except for Subassemblies.

ExpandAll() on the MethodTree also doesn’t seem to expand the child Subassemblies.

Did the subassemblies portion of this code ever get published? I copied the code above and it works great but I need the entire tree to be expanded.

Dan
I am trying to Customize some of the Tree Views in Job Entry and Job Tracker - I would like to expand the Tree on the Operations and Materials nodes as follows:

Is this possible - when I use the ExpandAll() - I expand too far:
image

Hope this makes sense.

Roberto.

I know this is old, but I wanted to just expand the first level nodes (Subassemblies, Operations, and Materials). I hacked this together and thought I would share.

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.JobEntry.JobEntryForm).GetField("jobTreeViewPanel", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance);
				treeviewPanel = (Ice.Lib.Framework.JobLib.MethodTreePanel) fieldInfo.GetValue(JobEntryForm);
				methodTree = treeviewPanel.MethodTree;
				TreeNodesCollection level1Nodes = methodTree.Nodes;
				foreach (UltraTreeNode l1Node in level1Nodes)
				{
					TreeNodesCollection level2Nodes = l1Node.Nodes;
					foreach (UltraTreeNode l2Node in level2Nodes)
					{
						TreeNodesCollection level3Nodes = l2Node.Nodes;
						foreach (UltraTreeNode l3Node in level3Nodes)
						{
							if (l3Node.Expanded == false)
							{
								l3Node.Toggle();
							}
						}
					}
				}
			}
		}
2 Likes