Question

Hide column on grid with dynamic columns

  • 10 November 2022
  • 2 replies
  • 275 views

I’m trying to customize a grid with dynamic columns, the number of columns are based on how many items it has on Attributes screen (CS205000).

 

Here are the samples,

 

Sample 1

 

Sample 2

 

I have the code in EntryMatrix_RowSelected event which will try to hide a column(s) based on certain condition

 

I tried using this code, but it didn’t work,

PXUIFieldAttribute.SetVisibility(sender, "Extra Small", PXUIVisibility.Invisible);
PXUIFieldAttribute.SetVisible(sender, "Extra Small", false);

 

I can’t also use this since it has no direct DAC attribute,

PXUIFieldAttribute.SetVisibility<DAC.attribute>(sender, null, PXUIVisibility.Invisible);
PXUIFieldAttribute.SetVisible<DAC.attribute>(sender, null, false);

 

Is there other way to hide column(s) maybe by name or index?


2 replies

Userlevel 6
Badge +4

Hi @tomwhitfoot 

I suggest you have a generic DAC with the supported maximum number of field attributes and then implement the control logic in your graph of how many dynamic columns are you handling on a specific context.

 

Suppose that your maximum is 10:

public class DAC : IBqlTable
{
...

#region Attr0
[PXDBDecimal]
[PXUIField(DisplayName = "Attr0", Visible = false)]
public virtual string Attr0 { get; set; }
public abstract class attr0 : PX.Data.BQL.BqlDecimal.Field<attr0> { }
#endregion

...
...

#region Attr10
[PXDBDecimal]
[PXUIField(DisplayName = "Attr10", Visible = false)]
public virtual string Attr10 { get; set; }
public abstract class attr10 : PX.Data.BQL.BqlDecimal.Field<attr10> { }
#endregion

}

Then your logic just map them to the real attribute. This way you have access to the specific field and then applying your logic is possible:

PXUIFieldAttribute.SetVisibility<DAC.attr0>(sender, null, PXUIVisibility.Invisible);
PXUIFieldAttribute.SetVisible<DAC.attr0>(sender, null, false);

 

Hi @Leonardo Justiniano, thanks for the response.

 

I’m not sure if I can apply that, the number of columns is based on Attribute ID line items, it has an indefinite number, if I keep adding new lines to the attribute values, the columns in the matrix view will expand further and I can select other attribute that has their own different number of columns.

 

 

Also, the column values are in string array in the event,

 

I’m not sure if I’m handing this on the correct event.

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