Reload Personalization or Revert Layouts to Last Saved

Is it possible to reload a personalization or revert to last saved on a load event or elsewhere in a customization?

Problem: I am using a customized epiultragrid. I set up a table on the load event, giving the column names, extended properties, etc. I then bind the table to epiultragrid. This puts the columns of the ultragrid in a specific order. Users have tried to move the columns around, and save the settings to a personalization. However, every time the user opens the form, the columns are placed back in their original order. If they Revert Layouts to Last Saved, the columns go back to what they had saved.

I am trying to get that process to happen after the table was binded to the ultragrid automatically. However, I am unsure how to accomplish this.

I looked at the trace logs. I could see where it is calling the customization, but I could not find when or how it was determining the personalization. I looked in the object explorer, session properties. There are lot in there, but I did not see anything that would indicate the personalization. Also, when I run the Revert Layouts to Last Saved process, I don’t see anything in the trace logs.

Any ideas would be greatly appreciated.

Thanks,

Jon (Frequent lurker, seldom poster)

Short answer: nope.
However, if the user is making complex personalizations, I would offer they should back up their own. Otherwise, the personalization could be made into a customization for everyone else.

Thanks Jason. That was what I thought, but I had a glimmer of hope that maybe there was something out there.

@jcraft - just curious … Do the personalizations to the grid (that you added via code), show in Customization Maintenance?

If so, maybe you could read the XML for the users personalization, prior to building that grid, and build it in the order the users personalization dictates. Or possible reformat grid (based the users personalization), after you build it.

Hi Calvin,

Looking through the XML, there is a property called visible position that seems to determine the order of the columns. I am going to play around with that to see if I have any luck.

Thanks!

How is load performance. You could always go with the brute force solution just make the last bit of code as the form comes up call the revert layouts action.

And what would the code to do that look like?

The load is fine and that is honestly one of my initial thoughts. But as Calvin mentioned, I am not sure what that code would look like. I have found no examples in trace logs, object explorer, or the internet as to call the revert layout to last saved action.

You can use the wizard to make an ToolClick event to fire when a menu item is clicked. But I have now idea how to initiate the menu items built-in function. Doing that, the tool names are:

  • SaveLayoutsTool
  • ResetLayoutsToBaseTool
  • ResetLayoutsToLastSavedTool

Every thing I found online was how to execute your own function, on a menu click. (I.E. create the handler and point it it to your function). Did come across a GitHub with some code for referencing the tollbars objects. Some user named @hkeric.wci. I didn’t dive into it, so no idea if it has anything useful. Here’s the GitHub link:

Honestly I assuming you professionals in this area would have that handy. I may be a PO on the framework but I’m rarely actually building customizations I rely on you experts. let me ask around.

Thank you Calvin. That set me on the correct path. The code is:

baseToolbarsManager.GetType().InvokeMember("FireEvent",BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.NonPublic, null,baseToolbarsManager, new object[] { ToolbarEventIds.ToolClick,
   		new ToolClickEventArgs(baseToolbarsManager.Tools["ResetLayoutsToLastSavedTool"], null) });
2 Likes