Skip to main content
Solved

Disabling custom action button on grid is not working


Forum|alt.badge.img

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!

Best answer by Naveen Boga

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

 

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

3 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3405 replies
  • Answer
  • April 14, 2023

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

 


Forum|alt.badge.img+9
  • Semi-Pro III
  • 229 replies
  • April 14, 2023

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


Joe Schmucker
Captain II
Forum|alt.badge.img+2

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.  


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