Skip to main content
Answer

Button in grid does not refresh when triggering an on-screen warning

  • June 23, 2025
  • 2 replies
  • 74 views

Forum|alt.badge.img

When recording, a dedicated button should appear, but it doesn't because there's a warning on the screen. Can anyone help me resolve this?

 

Here is my action code

public PXAction<PX.Objects.AR.ARInvoice> LoadDocumentsPro;
        [PXButton(CommitChanges = true)]
        [PXUIField(DisplayName = "Load Documents")]
        protected virtual void loadDocumentsPro()
        {
           
              
 
        }

Here is my code where I do the validation to show the action, it works when there is no warning, if there is the event does not work.

  protected virtual void _(Events.RowSelected<ARInvoice> e)
        {
            var row = e.Row;
            var cache = e.Cache;
            if (row != null)
            {
                bool validacionPro = false;
                bool validacionPro2 = false;
                PXResultset<XTProformaInvoice> value_1 = this.proformaView.Select();
                foreach (XTProformaInvoice item in value_1)
                {
                    if (item.Loaded == false || item.Loaded == null) validacionPro = true;
                }
                if (validacionPro == true && value_1.Count >= 1)
                {
                    Base.release.SetEnabled(false);
                }


                if (cache.GetStatus(row) == PXEntryStatus.Inserted) validacionPro2 = true;
                if (validacionPro2 == true)
                {
                    LoadDocumentsPro.SetVisible(false);
                }
                else
                {
                    LoadDocumentsPro.SetVisible(true);
                }
            }
        }

Best answer by darylbowman

Why this is happening, I cannot exactly describe, but I think you should be extending the event handler because RowSelected is already used in the base graph:

 

So:

protected virtual void _(Events.RowSelected<ARInvoice> e, PXRowSelected b)
{
    b?.Invoke(e.Cache, e.Args);

    // Your other code
}

This will execute the base event handler first. If that doesn’t work, you could put your code first and execute the base after the fact, as long your code doesn’t cause execution to return beforehand.

2 replies

darylbowman
Captain II
Forum|alt.badge.img+15
  • Answer
  • June 23, 2025

Why this is happening, I cannot exactly describe, but I think you should be extending the event handler because RowSelected is already used in the base graph:

 

So:

protected virtual void _(Events.RowSelected<ARInvoice> e, PXRowSelected b)
{
    b?.Invoke(e.Cache, e.Args);

    // Your other code
}

This will execute the base event handler first. If that doesn’t work, you could put your code first and execute the base after the fact, as long your code doesn’t cause execution to return beforehand.


Forum|alt.badge.img
  • Author
  • Freshman II
  • June 27, 2025

Thank you very much, I appreciate it!