Solved

Disabling custom action button on grid is not working

  • 14 April 2023
  • 3 replies
  • 271 views

Userlevel 1

Hello!

Mi instance is 22R2 and until now, conditionally enabling/disabling custom actions had been pretty easy.

Usually I just use the SetEnable Method in a RowSelected event… Like this one here that I’m trying to use for a custom action in the SOInvoice screen:

 protected void _(Events.RowSelected<SOInvoice> e)
{
SOInvoice row = e.Row;
if (row == null) return;
itemSearch.SetEnabled(Base.Document.Current.CustomerID == null ? false : true);

}

The problem that I’m facing right now is that visually, the button remains “Enabled” at all times, while logically the button is disable until the user enters the customer:

When the user clicks on the button without entering a Custmer. The condition works and the system display the alert: 

But the button remains visually enabled and my eye is twitching becouse of this!

In the aspx I placed the button inside the actionbar like I have done with many other customizations:

<ActionBar>
<CustomItems>
<px:PXToolBarButton Text="Search Items">
<AutoCallBack Target="ds" Command="ItemSearch">
<Behavior CommitChanges="True" PostData="Page" /></AutoCallBack></px:PXToolBarButton>
<px:PXToolBarButton Text="Add Order" Key="cmdShipmentList">
<AutoCallBack Command="SelectShipment" Target="ds">
<Behavior PostData="Page" CommitChanges="True" ></Behavior>
</AutoCallBack>
</px:PXToolBarButton>

I hope somebody could give light on this little frustrating issue.

Thanks!

icon

Best answer by Naveen Boga 14 April 2023, 04:32

View original

3 replies

Userlevel 6
Badge +3

Thanks for the links.  I was able to get the button to show as disabled on the Sales Quotes screen but not the Opportunities screen by adding the StateField.  Exact same c# code, exact same ASPX code on both screens.  It doesn’t work on the Opportunities screen.

This still does not allow me to hide the button.

The button was a “professional” add on to make the screen better.  Since I cannot hide a custom button, I’m just removing it.  I’ve spent enough time on it.

I appreciate the effort from you both.  

Userlevel 7
Badge +10

Hi @albertobello83 ,


I have found similar article for your question, could you please go through this.

Corrcetly disabling a custom action button | Community (acumatica.com).
 

Hope, It helps!
 

Regards,

Sweta

Userlevel 7
Badge +17

Hi @albertobello83  Basically enabling/disabling the grid action based on the below two properties for the PXToolBarButton control.

  1. StateColumn
  2. DependOnGrid

Please find the article link below for your reference.

https://blog.zaletskyy.com/post/2015/01/27/post78

 

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