Solved

Columns in my custom grid not automatically added to the UI

  • 21 September 2023
  • 4 replies
  • 111 views

Userlevel 6
Badge +3

When I publish my customization, several fields do not show in the grid by default.  I want all columns in my grid showing by default.  When the customer publishes the package, I don’t want them to have to open the screen and manually add the columns to the grid.

 

This is the list of columns in the project editor.

Is there some setting that is making the three fields on the left not be included by default on the right?  I don’t see any options in the editor that would seem to handle this.

 

icon

Best answer by Naveen Boga 22 September 2023, 02:23

View original

4 replies

Userlevel 7
Badge +17

Hi @Joe Schmucker In the DAC level, if we mention Visible =false then those will not be shown in the grid and will be available under the Column Configuration.

Remove this property from you DAC then it will be added to your grid by default.

 

Userlevel 6
Badge +3

@Naveen Boga I am using a PXProjection based on SOLine,  Those three fields are from the SOLine DAC and I would guess that they are set to not visible in the original DAC.

I wanted to get the Order Number to show up in my processing results dialog, so I added “MyOrderNumber” to my projection.  If I did not specifically put the field in my Projection, it would not show in the results dialog.  In order to keep from getting the error that my declaration is hiding another, I called the field “MyOrderNumber”.  

 

 

The other way I found is to use an extension on my graph.  Seems kind of clunky to do it this way though, but it is easier than redefining the entire field with the selectors etc.

    // Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
    [PXNonInstantiatedExtension]
    public sealed class SO_SOLine_ExistingColumn : PXCacheExtension<PX.Objects.SO.SOLine>
    {
        #region InventoryID  
        [PXMergeAttributes(Method = MergeMethod.Append)]
        [PXUIField(DisplayName = "Inventory ID", Visible = true)]
        public int? InventoryID { get; set; }
        #endregion
    }

 

This extension fixed the issue.  

Userlevel 7
Badge +17

@Joe Schmucker  Yes, this approach will suffice. However, I would recommend utilizing the Cache Attached event instead of extending the DAC to add the same field. By doing so, you future-proof your code in case there are any modifications to the base field in upcoming versions. Using the Cache Attached event as shown below can help you avoid the need for rework

 

  public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
[PXMergeAttributes(Method = MergeMethod.Merge)]
[PXRemoveBaseAttribute(typeof(PXUIFieldAttribute))]
[PXUIField(DisplayName = "Order Nbr.", Visible = true, Enabled = false)]
protected virtual void _(Events.CacheAttached<SOLine.orderNbr> e) { }
}

 

Userlevel 6
Badge +3

Thanks @Naveen Boga.  There are a bunch of ways to do things in Acumatica.  I always appreciate learning the best practices.

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