Nickolas Hook
Nickolas Hook

Reputation: 804

Hide Columns in Grid by Default

With a new custom screen/graph/DAC, how can I make columns in a grid hidden by default? That is I want the column / controls in the Grid but only shown if the user goes in to the Column Configuration and selects to add it. (These are purely informational columns on the grid of a custom Processing screen)

Upvotes: 1

Views: 1150

Answers (2)

Hugues Beauséjour
Hugues Beauséjour

Reputation: 8268

Visibility of DAC fields is controlled by PXUIField attribute properties.

  • The 'Visible' property determines whether or not the field is shown on screen.
  • The 'Visibility' property determines whether or not the field is available for display.

For your use case, you want to hide it by default (Visible = false) and make it available for display in the grid column selection dialog (Visibility = PXUIVisibility.Visible):

[PXUIField(Visibility = PXUIVisibility.Visible, Visible = false)]

You can also set these properties using static functions instead of DAC field attributes:

PXUIFieldAttribute.SetVisibility(cache, null, typeof(DAC.field).Name, PXUIVisibility.Visible);
PXUIFieldAttribute.SetVisible(cache, null, typeof(DAC.field).Name, false);

Upvotes: 3

Brendan
Brendan

Reputation: 5613

In the DAC or Graph you can set the fields Visible property to false

Example found on sales order for the "Line Order" field.

#region SortOrder
public abstract class sortOrder : PX.Data.IBqlField
{
}
protected Int32? _SortOrder;
[PXUIField(DisplayName = AP.APTran.sortOrder.DispalyName, Visible = false, Enabled = false)]
[PXDBInt]
public virtual Int32? SortOrder
{
    get
    {
        return this._SortOrder;
    }
    set
    {
        this._SortOrder = value;
    }
}
#endregion

Upvotes: 0

Related Questions