Solved

How can I track "Side Panels" in Screens?

  • 20 January 2023
  • 6 replies
  • 79 views

Userlevel 7
Badge +9

I am running 21R2 21.205

In a graph,

  1. How can I listen to system events to see if a "Side Panel" is open?
  2. If there are multiple Side Panels, how do I know which one is currently Active?
  3. Can I programmatically force to refresh “Side Panel” when an EventHandler is triggered?
icon

Best answer by Yuriy Zaletskyy 22 January 2023, 08:24

View original

6 replies

Userlevel 5
Badge +3

According to my knowledge it is not possible to see, if side panel is open, unless to use methods, which will not pass certification.

I’d suggest following steps:

  1. Add some boolen field at the DAC class, and name it for exampe IsSidePanelOpen.
  2. Via js hide it
  3. via js track, if sidepanel is open
  4. if panel is open, again, via js modify value of that field

In graph read information from that field. 

something like this:

using PX.Data;

public class MyDAC : IBqlTable
{
// ... other fields

[PXBool]
[PXUIField(DisplayName = "Is Side Panel Open", Visible = false)]
public virtual bool? IsSidePanelOpen { get; set; }
public abstract class isSidePanelOpen : IBqlField { }
}

and js I’d foresee like this:

$(document).ready(function () {
// Hide the IsSidePanelOpen field on the page
$("#IsSidePanelOpen").hide();

// Track the condition of the "Side Panel"
if (PX.Web.UI.PXPage.IsCallback) {
// A "Side Panel" is open
// Update the value of the IsSidePanelOpen field
$("#IsSidePanelOpen").val(true);
}
});

 

 

 

Userlevel 7
Badge +9

@Yuriy Zaletskyy Thanks for the explanation. For Clarification, I have added “displayRevisionLog” Action through the customization package as shown in the below screenshot

 

 

Following your instructions, I have added the “using PX.Data; using PX.Web.UI;” directives but PXWebContext is not recognized

I search the Acumatica Source to see if I can find a sample of how this is used in practice but couldn’t find anything in the source codes:

 

Any idea what reference should I add to my project or directive should I use?

 

Userlevel 7
Badge +9

I swear I saw the below code sample and some explanation/suggestion from @Yuriy Zaletskyy  but it is gone now

 

        public PXAction<MyDAC> myAction;
        protected void myAction_Handler(PXAdapter adapter)
        {
            // Check if a "Side Panel" is open
            bool sidePanelOpen = PXWebContext.GetContext().IsSidePanelOpen;

            // Find the active "Side Panel" view
            PXView activeView = null;
            foreach (PXView view in PXContext.Views)
            {
                if (view.IsSidePanel)
                {
                    activeView = view;
                    break;
                }
            }

            // Refresh the active "Side Panel" view
            if (activeView != null)
            {
                activeView.RequestRefresh();
            }
        }

Userlevel 5
Badge +3

I swear I saw the below code sample and some explanation/suggestion from @Yuriy Zaletskyy  but it is gone now

 

        public PXAction<MyDAC> myAction;
        protected void myAction_Handler(PXAdapter adapter)
        {
            // Check if a "Side Panel" is open
            bool sidePanelOpen = PXWebContext.GetContext().IsSidePanelOpen;

            // Find the active "Side Panel" view
            PXView activeView = null;
            foreach (PXView view in PXContext.Views)
            {
                if (view.IsSidePanel)
                {
                    activeView = view;
                    break;
                }
            }

            // Refresh the active "Side Panel" view
            if (activeView != null)
            {
                activeView.RequestRefresh();
            }
        }

yes, your eyes didn’t lie to you. I’ve confused Acumatica with another CMS system, and gave you code from that system. I’m very sorry for confusion

Userlevel 7
Badge +9

No Problem. Thank you. Any other thoughts? because I do not think I will be able to use methods that do not pass the certification. 

Userlevel 5
Badge +3

No Problem. Thank you. Any other thoughts? because I do not think I will be able to use methods that do not pass the certification. 

use provided sample, and then refine it with Acumatica during certification. Potentially Acumatica certification team will make an exception for you during certification. You just need to prepar solid reasons, why that functionality is mandatory for business. As another way, to have some parts certified, and js as addendum, which is not certified, but used separetly. 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved