How to Set Active Row and Update epiDataView

I am trying to select the most recent revision by default when a Part is loaded in Part Maintenance. Basically, it displays the revisions in ascending order and selects the first row by default (and shows that in the Details tab). I want to make it sort in descending order and select the most recent row (the first row). I don’t need the exact code if you can just paraphrase the sequence I need to follow.

Thanks in advance!

Should I be working on the Ultragrid? The epiView? etc. I’m sort of poking around and I can’t seem to find anything that works in Google and my understanding of the objects is still very little.

You should be working with the view. You can get the current row by getting ahold of the view and .Row is the current row.

The object explorer has the data views that are available in the customization, and some basic code to show you how to get ahold of the data.

image

1 Like

Great feedback! Thank you.
I’ll give it a go.

Final solution:
I added an EpiViewNotification on the Part view.
Then I changed the notification type to Initialize.

	private static void edvPart_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))
			{
				if (edvPartRev.dataView.Count > 0)
				{
					edvPartRev.Row = edvPartRev.dataView.Count - 1;
				}
			}
		}
	}
1 Like