1

I'd like to add a custom button to the header of the Bills and Adjustments screen that will contain custom actions in a dropdown, ala the 'Actions' button that's already there (I don't want to add these actions to the existing 'Actions' button - I want my own dropdown containing custom actions).

I know how to add actions to the existing 'Actions' button, but is there a way to do what I'm looking to do?

1 Answer 1

1

It is the same step just using your own drop button. You need to add your "Actions" button and then do the same steps to the other buttons to add them to your main drop down button.

Here is a quick example below. I created a MyDropMenu action button which all of my other buttons live under:

//within initialize or graph constructor...
MyDropMenu.AddMenuAction(MyAction1);
MyDropMenu.AddMenuAction(MyAction2);
MyDropMenu.AddMenuAction(MyAction3);
//...


public PXAction<PrimaryDac> MyDropMenu;
[PXUIField(DisplayName = "My Drop Menu", MapEnableRights = PXCacheRights.Select)]
[PXButton(MenuAutoOpen = true)]
protected IEnumerable myDropMenu(PXAdapter adapter)
{
    return adapter.Get();
}

public PXAction<PrimaryDac> MyAction1;
[PXUIField(DisplayName = "My Action 1", MapEnableRights = PXCacheRights.Select)]
[PXButton]
protected IEnumerable myAction1(PXAdapter adapter)
{
    return adapter.Get();
}

public PXAction<PrimaryDac> MyAction2;
[PXUIField(DisplayName = "My Action 2", MapEnableRights = PXCacheRights.Select)]
[PXButton]
protected IEnumerable myAction2(PXAdapter adapter)
{
    return adapter.Get();
}

public PXAction<PrimaryDac> MyAction3;
[PXUIField(DisplayName = "My Action 3", MapEnableRights = PXCacheRights.Select)]
[PXButton]
protected IEnumerable myAction3(PXAdapter adapter)
{
    return adapter.Get();
}

You also need to add the callback command for the drop menu action to the page like this...

<px:PXDSCallbackCommand Name="MyDropMenu" Visible="True" CommitChanges="true" StartNewGroup="true" ></px:PXDSCallbackCommand>

I tested this on a Sales Order Extension replacing PrimaryDac to SOOrder and shows up as:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.