Skip to main content
Solved

How can I track "Side Panels" in Screens?


aaghaei
Captain II
Forum|alt.badge.img+10

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?

Best answer by Yuriy Zaletskyy

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);
        }
    });

 

 

 

View original
Did this topic help you find an answer to your question?

6 replies

Yuriy Zaletskyy
Jr Varsity I
Forum|alt.badge.img+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);
        }
    });

 

 

 


aaghaei
Captain II
Forum|alt.badge.img+10
  • Author
  • Captain II
  • 1180 replies
  • January 22, 2023

@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?

 


aaghaei
Captain II
Forum|alt.badge.img+10
  • Author
  • Captain II
  • 1180 replies
  • January 22, 2023

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();
            }
        }


Yuriy Zaletskyy
Jr Varsity I
Forum|alt.badge.img+3
aaghaei wrote:

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


aaghaei
Captain II
Forum|alt.badge.img+10
  • Author
  • Captain II
  • 1180 replies
  • January 22, 2023

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. 


Yuriy Zaletskyy
Jr Varsity I
Forum|alt.badge.img+3
aaghaei wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings