Skip to main content
Answer

Issue with Data Disappearing in Custom Tab Grid after I hover the mouse over the grid header

  • July 22, 2025
  • 9 replies
  • 140 views

Forum|alt.badge.img

 Hello All,

I have a scenario where I created a new tab called “MyOrder” on the Sales Order screen (SO301000) using a Customization Project. Inside this tab, I have a grid bound to a custom table (MyOrder) that has a foreign key relationship with SOOrder (OrderType and OrderNbr).

The grid correctly shows the data after I insert records inside the RowPersisted event of SOOrderEntry. The data comes from an API call (currently hardcoded for testing). Here is a simplified version of my code:

public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>

 {                                                                       

     public PXSelect<MyOrder,

         Where<MyOrder.ordertype, Equal<Current<SOOrder.orderType>>,

           And<MyOrder.orderNr, Equal<Current<SOOrder.orderNbr>>>>>

     MYOrder;

 

     protected void _(Events.RowPersisted<SOOrder> e)

     {

         SOOrder row = (SOOrder)e.Row;

         if (row == null) return;

 

         if (e.TranStatus.ToString() == "Completed")

         {

             var graph = PXGraph.CreateInstance<SOOrderEntry>();

             var myorder = new MyOrder

             {

                 Ordertype = row.OrderType,

                 OrderNr = row.OrderNbr,

                 Description = "Hardcoded Test Data"

             };

 

             graph.Caches<MyOrder>().Insert(myorder);

             graph.Actions.PressSave();

         }

     }

 }

Problem:

  • After clicking Save, the data appears in the grid immediately 
  • However, if I hover the mouse over the grid header, the grid becomes empty.
  • On reload the screen manually then the data is shown in the grid and it stay there even after the mouse over .
  • On checking the database, the data is correctly inserted after save.

How can I ensure the grid retains the inserted data in the UI after save without disappearing on hover?

 

Any best practice advice for handling API-based data inserts in relation to the UI grid would be really helpful!

Thank you!

Best answer by Abhishek Niikam

​Hello, @PraveenBeo from above issues I suggest you :
Go to Customization Editor and set :

Height (what best for you like 300px) and

Width = 100%. 

From above snaps I saw probably there is no properties set to that grid.

Give it try.

I hope it helps!
 

9 replies

Forum|alt.badge.img+1
  • Semi-Pro III
  • July 22, 2025

Hi, ​@PraveenBeo 

I noticed in your code that you are not calling the base method in the RowPersisted event. Since SOOrder has overridden persist logic, it's better to include that.

Also, you are creating a new instance of SOOrderEntry, but you're already inside that graph, so there's no need to create it again. You can directly use the current graph to insert the data.

 var graph = PXGraph.CreateInstance<SOOrderEntry>();

That should help keep the grid data in sync with the UI.

Thanks!!!


darylbowman
Captain II
Forum|alt.badge.img+15

Using the RowPersisted event is not a good place to do what you’re doing. Acumatica can handle this situation for you.

  1. Add a foreign key type to SOOrder on your MyOrder DAC:
    public static class FK
    {
    public class Order : SOOrder.PK.ForeignKeyOf<SOLine>.By<orderType, orderNbr> { }
    }

    (where orderType and orderNbr are the BQL property types of your MyOrder DAC)

  2. Add a PXParent attribute to *one* (not both!) of your MyOrder DAC key fields:

    [PXParent(typeof(FK.Order))]

  3. Then add [PXDBDefault] to the foreign keys of your MyOrder DAC. Acumatica will set these values when they become available:
    [PXDBDefault(typeof(SOOrder.orderType))] for OrderType
    [PXDBDefault(typeof(SOOrder.orderNbr))] for OrderNbr


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • July 23, 2025

Hi, ​@PraveenBeo 

I noticed in your code that you are not calling the base method in the RowPersisted event. Since SOOrder has overridden persist logic, it's better to include that.

Also, you are creating a new instance of SOOrderEntry, but you're already inside that graph, so there's no need to create it again. You can directly use the current graph to insert the data.

 var graph = PXGraph.CreateInstance<SOOrderEntry>();

That should help keep the grid data in sync with the UI.

Thanks!!!

@Saikrishna V  

protected void _(Events.RowPersisted<SOOrder> e)
     {
         SOOrder row = (SOOrder)e.Row;
         if (row == null) return;

         if (e.TranStatus.ToString() == "Completed")
         {
             var myorder = new MyOrder
             {
                 Ordertype = row.OrderType,
                 OrderNr = row.OrderNbr,
                 Description = "Hardcoded Test Data"
             };
             Base.Caches<MyOrder>().Insert(myorder);
             Base.Actions.PressSave();
         }
} Changed Like this. But it will make an Infinite loop because of the   Base.Actions.PressSave(); If we remove Base.Actions.PressSave(); It does not work . Thank you for your time .


Forum|alt.badge.img+1
  • Semi-Pro III
  • July 23, 2025

@PraveenBeo 

As per ​@darylbowman  suggestion, you can try setting up the PXParent child relationship for your custom grid tab. This approach should help prevent the data from being wiped out by properly establishing the parent-child link between your custom DAC and the SOOrder.

Thanks


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • July 23, 2025

Using the RowPersisted event is not a good place to do what you’re doing. Acumatica can handle this situation for you.

  1. Add a foreign key type to SOOrder on your MyOrder DAC:
    public static class FK
    {
    public class Order : SOOrder.PK.ForeignKeyOf<SOLine>.By<orderType, orderNbr> { }
    }

    (where orderType and orderNbr are the BQL property types of your MyOrder DAC)

  2. Add a PXParent attribute to *one* (not both!) of your MyOrder DAC key fields:

    [PXParent(typeof(FK.Order))]

  3. Then add [PXDBDefault] to the foreign keys of your MyOrder DAC. Acumatica will set these values when they become available:
    [PXDBDefault(typeof(SOOrder.orderType))] for OrderType
    [PXDBDefault(typeof(SOOrder.orderNbr))] for OrderNbr

@darylbowman  

  #region OrderNr
  [PXDBString(50, InputMask = "")]
  [PXUIField(DisplayName = "Order Nr")]
      [PXDBDefault(typeof(SOOrder.orderNbr))]
      [PXParent(typeof(SelectFrom<SOOrder>.
  Where<SOOrder.orderNbr.
  IsEqual<MyOrder.orderNr.FromCurrent>>))]
      public virtual string OrderNr { get; set; }
  public abstract class orderNr : PX.Data.BQL.BqlString.Field<orderNr> { }
  #endregion

I have already given the PXParent attribute for OrderNr. as shown above . If RowPersisted is not a good place , can you please suggest a suitable event from where can I call my api and update child DAC as per the result from api .  Thank you for your time 


Forum|alt.badge.img+1
  • Semi-Pro III
  • July 23, 2025

@PraveenBeo 

As far as I know, you should consider using the RowUpdated or RowInserted events.
For the [PXParent] attribute, make sure to include both OrderType and OrderNbr. Here's a sample:

[PXParent(typeof(Select<SOOrder, Where<SOOrder.orderType, Equal<Current<orderType>>, And<SOOrder.orderNbr, Equal<Current<orderNr>>>>>))]

 


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • July 23, 2025

@Saikrishna V For make it simple I removed OrderType  from DAC . 

And moved to RowUpdated event .

public SelectFrom<MyOrder>
    .Where<MyOrder.orderNr.IsEqual<SOOrder.orderNbr.FromCurrent>>
    .View MYOrder;

protected void _(Events.RowUpdated<SOOrder> e)
{
     var row = e.Row;
     var myorder = new MyOrder
     {
         Description = "Hardcoded Test Data"
     };
 
     MYOrder.Insert(myorder);
     Base.Document.View.RequestRefresh();
     MYOrder.View.RequestRefresh();

On save The orderNr is correctly inserted in database (I think the PXParent works) and data is shown in the grid inside the tab. But still on mouse over to the grid header the grid become empty .

The grid is shown correctly after save . But on mouse over to grid header shown below . Thank you for your time and effort 

 


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • July 23, 2025

 


Forum|alt.badge.img+2

​Hello, @PraveenBeo from above issues I suggest you :
Go to Customization Editor and set :

Height (what best for you like 300px) and

Width = 100%. 

From above snaps I saw probably there is no properties set to that grid.

Give it try.

I hope it helps!