Search code examples
acumatica

Hide a PXButton on a popup screen


I am trying to hide a PXButton on a popup screen

enter image description here

Here is my code:

protected void _(Events.RowSelected<POReceipt> e)
{
    if (e.Row is null) return;
    ActionMoveAll.SetEnabled(e.Row.ReceiptType == POReceiptType.TransferReceipt);
    ActionMoveAll.SetVisible(e.Row.ReceiptType == POReceiptType.TransferReceipt);
}

<px:PXButton runat="server" ID="btnfillwithall" CommandName="actionMoveAll" CommandSourceID="ds" />

I have set AutoRepaint="true" and autoreload="true" and loadOnDemand="true" all to no luck. When the PXButton hits the server I do get a popup saying "the FillWithAll action is disabled", but I would like for it just to be removed entirely from the popup instead of just getting an error response.


Solution

  • You should not do ActionMoveAll.SetVisible() in the primary DAC RowSelected event handler _(Events.RowSelected<POReceipt> e). You should move ActionMoveAll.SetVisible(e.Row.ReceiptType == POReceiptType.TransferReceipt) to your popup window DAC RowSelected event handler. In your case it might be like _(Events.RowSelected<POReceiptLineAllocation> e)

    Add SyncVisible="" to your PXButton as well. Set it to True (or False if True doesn't work, and check the result. One setting should work)