Bikash Lama
Bikash Lama

Reputation: 187

Create a generic popup panel

I have added a Global Button with the following code.

 public override void Initialize()
        {
            if (!String.IsNullOrEmpty(Base.PrimaryView))
            {

                Type primaryViewItemType = Base.Views[Base.PrimaryView].Cache.GetItemType();
                PXAction action = PXNamedAction.AddAction(Base, primaryViewItemType, "SubmitTicket", "Submit Ticket", TestClick);
            }
        }

        public IEnumerable TestClick(PXAdapter adapter)
        {
            throw new PXException("Button clicked from graph" + Base.GetType().Name);
        }

And it renders the button like this in each of the pages. enter image description here

Now, I would like to display a popup panel, on button's click. I know I can create a popup panel on screen section. But, is there some way that I can have a general popup panel created in one place and can be displayed on each of the pages on the button's click?

Thank you.

Upvotes: 0

Views: 709

Answers (2)

Brendan
Brendan

Reputation: 5623

As @HB_ACUMATICA mentioned there is no good easy way.

Providing another alternative to his post, you can create a graph and use it as a reusable popup by calling:

throw new PXPopupRedirectException(graph, string.Empty, true)

One thing I ran into was a sizing issue on the popup...

Changing the height/width when calling another graph as an in-page popup using PXPopupRedirectException

If you do copy and paste the PXSmartPanel you can create re-usable business logic by implementing the reusable business logic pattern found in this help as a starting point:

Reusing Business Logic

Upvotes: 1

Hugues Beauséjour
Hugues Beauséjour

Reputation: 8278

If I understand correctly you want to share the same PXSmartPanel control in different pages without having to copy/paste it in every screen.

In Acumatica Framework this is achieve by custom container controls like 'PXUploadDialog' which derives functionality from other controls like 'PXSmartPanel'. This is the control that is used when you attach files in all screen.

Unfortunately there seems to be no documentation on how to achieve this. The closest I found is this SO question which is essentially unanswered: Create custom User Control for Acumatica

Considering this, you may want to copy/paste the same smart panel in all screen. To ease copying you can use the 'Edit ASPX' feature, make sure you backup the project before.

Edit ASPX to get to the code: enter image description here

Copy paste your smart panel in the page and click 'GENERATE CUSTOMIZATION SCRIPT' to package the changes in the project: enter image description here

Upvotes: 0

Related Questions