Refresh a specific grid with a button

So, since the regular summary grids are not available to me because of the bug in 10.600.5 that does show properties of a grid, I need to add in a grid in the customization to be able the get the necessary properties to interact with the grid.

Not a big deal, however, now I am trying to merge 3 different queries into one dashboard. I put the tracker and the summary on separate tabs because the summary is useless and I don’t want it to show. It’s a little messier than I would like, however it functions ok, except for one thing.

If I am on one of the tracker views and I click refresh, the only query that refreshes is the first query. In order to get the second and third queries to refresh, I have to activate the summary grid, then hit refresh, then go back to the tracker. This workaround won’t be acceptable for shop floor employees.

While I can use the refresh all, the first query runs a little long if nothing a filter isn’t filled out, so it’s kind of a pain.

Ideally what I would like to do is use a custom button to call the refresh on a specific query. Any insight on how to do this? This works for the refresh button on top, but will still have the same issues with the focus on the grid.

MainController.AppControlPanel.HandleToolClick(“RefreshTool”, new Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools[“RefreshTool”], null));

My first instinct is to try and do a goofy focus swithch, refresh, then switch back, which I think could work, but there is probably a more elegant way.

I don’t know very well how the notifications work, can I use this to trigger a refresh on add rows? This would work well for one of the queries, however I imagine I will have the same problem with refreshing the specific one…

private void edvV_EndActivity_1View_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.AddRow))
	{
		if ((args.Row > -1))
		{
		}
	}
}

Is adding Refresh All a possibility?

Kind of. One of the queries returns a lot of data and is kind of slow, so I didn’t want to go that route if I don’t have to.

AAGGGGGGHHHHHHH.

I figured out how to set the grid that I need in focus EXCEPT, the same bug that is making me have to do this workaround with the custom grid added to the tracker instead of using the normal one, prevents me from programmatically setting focus on it!

Guess I’ll have to stick with the refresh all… Until 10.2, which should be hopefully soon.

ok @Chris_Conn I can’t figure out how to get the names of the toolbar tools to set me refresh button to refresh all. This does the refresh button. I’m assuming it would be “RefreshAllTool”, but I would like to know how to get the properties just for knowledge sake.

			MainController.AppControlPanel.HandleToolClick("RefreshTool", new 
			Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));

For the menu names, check here: Getting error when attempting to list all tool menu items - #5 by asmar - ERP 10 - Epicor User Help Forum

What is the issue with getting focus?
Also, are we sure the issue is the grid itself is not focused, or because its not visible (aka the sheet it’s on is hidden/not active) - If it’s the latter, focus the page first

So here is the bug that doesn’t let me get the grid control.

the focus that I found was for a control. I tried using the the view panel name and that did not work. I don’t know how to set the focus on the tab.

I’ll check out that tools menu list. Thanks.

edit: Well, I couldn’t figure out how to make the toolbar properties work, so I just tried “RefreshAllTool” and it worked. I will add the properties lookup to my ever growing list of this things to try to understand in C#.

Cant you get the guid of the control, and cast it to the proper type (as shown in explorer)?

var SelectPanel = (Erp.UI.App.SelectSerialNumbersEntry.SelectPanel)csm.GetNativeControlReference(“ea240c45-ea82-4a87-b2b6-067e37c94b7f”);
SelectPanel.Focus();

Also, is this a runtime or assembly dashboard? It matters! Definitely always export your dashboards as assemblies and do ALL of your customization there.

nope, it won’t expand past that point. Hence the bug which led me down this frustrating path. It’s only in
dashboards that it does this, and only for the summary grids that the system puts in there. When I add my own grids I can get to what I need.

Yup, it’s assembly, and I am doing my customizations in there. We’ve been down that road before! (remember writing out CSV files?)

Remember? haha I cant remember what I worked on right after lunch (true story, I am trying to log my time haha).

You are confident that panel has your controls? What happens when you click your desired controls on form design, does it not expand and select it in the tree?

Exactly. Service says it’s a bug and it’s supposed to be fixed in 10.2. I worked in 10.0.700, then when we went to 10.1.600.5 it didn’t work.

Seems to be this should be a bigger problem, but it seems I’m one of the few that likes to build customizations on top of dashboards. I find the native epicor screens much too complicated and too tedious for the way our business is set up. We run most of our shop on home grown dashboards. Currently I am working a replacement for the work queue to be able to filter by the information that we regularly use, and not by other things that epicor wants us to use. I’m getting close to being ready to deploy, just working on cleaning up as much of the idiosyncrasies that I am capable of, (which thank God is a growing list, my capabilities that is!)

Use the Custom XML editor and find your controls in there if you dare. You could use the ParentControlKey property (= panel guid) to find on the beast that live under that panel.

You may have to do that again if you find additional hierarchy below that (other sheets, panels, groupboxes, etc)

Once you get the guid and the type, you can wrestle that bear

That only works when you’ve already customized it, like the things I already did in 10.0 and upgraded. On new dashboards, it won’t show up. I got bummed when I figured that out…

is there a child property key? That’s what I really need.

Damn, that is tough. Well I learned something new today. I thought all of the native controls were in the XML too. I wonder if one could just loop thru all the controls and list only the panels (and their GUIDs)

@Banderson I’m with you. I’ve used a deployed dashboard to create customised work reporting screen:

My latest personal win, was getting this bit to work. It’s taking the selected row of the grid, then calling BAQ Adapter to populate the lot tracked materials bit, then that row is used to find all available lots.

1 Like

If you like hacky workarounds you’ll love this. Get all the panels and their GUID of your form (be sure to change your form name)


	private void PanelCheck(Control control)
	{
	if(control == null) return;
	
		if(control.GetType().ToString().ToLower().Contains("panel"))
		{
			EpiBasePanel pn = (control as EpiBasePanel);
			string guid = "";
			if(pn != null)
			{
				guid = pn.EpiGuid;
			}
	
			var res = string.Format("{0} {1} {2}\n",control.Name,guid, control.GetType().ToString());
			controlslist += res;
		}
	}

	private void ProcessAllControls(Control rootControl, Action<Control> action)
	{
		
	    foreach (Control childControl in rootControl.Controls)
	    {
			if(childControl != null)
			{
		        ProcessAllControls(childControl, action);
		        action(childControl);
			}	
	    }
			
		
	}


	private void CustShipForm_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
		
		ProcessAllControls(CustShipForm, ctl => PanelCheck(ctl));
		if(controlslist != "")MessageBox.Show(controlslist);
	}

2 Likes

I’ll try it out tomorrow!

So that get’s me all of the panels, If I change “Panel” To “Grid” will that get me all of the grids?

p.s. getting GUIDS in a window that you can’t copy and paste from is just cruel… I may have to add a write out to text file…

You can do a Ctrl+C to copy the message box text.

Also, see this post.

1 Like

Thanks for the tip! The feedback when you do that makes it seem like it won’t copy, but lo and behold it does!

So I got it to work by changing this:

if(control.GetType().ToString().ToLower().Contains(“panel”))

to this:

if(control.GetType().ToString().ToLower().Contains(“grid”))

and this

EpiBasePanel pn = (control as EpiBasePanel);

to
EpiUltraGrid pn = (control as EpiUltraGrid);

and now I get.

myGrid 18c1507c-c20e-44b5-a163-642d05d67d8b Ice.Lib.Framework.EpiUltraGrid
CustomGrid 994a7055-2964-46f1-8488-0c2359109f4f Ice.Lib.Framework.EpiUltraGrid

yay!

As you can see from the example you linked to, I’ve been dealing with this problem since July. I was just too green at the time to understand how to get help from Jose in the coding. I’m getting better at it now, thankfully.

Well, I got the focus thing to work, however, it doesn’t do the same thing as actually clicking in the grid. So it focuses to the grid, then refreshes (the old way, everything else but that grid) and then focuses back.

grrrrrrrrr.

However, now that I can get to the provided grid, I may be able to use the provided grid instead of the custom added one, which could help alleviate the problem. I still can’t get to the GUI controls, but I think I can set up what I need in the dashboard before it’s deployed so I don’t think it will be too bad.

It’s the little things that kill you.