Hi Everyone,
Sometimes you need to show user interface differently depend on parameters selected. Here I want to show you an approach where you can show different grids depend on parameters selected in filter.
You may need different grids in the following cases:
- If have different data access classes (tables) to show.
- If you need to have different grids layout depend on parameters.
- If you need to to have different columns configurations.
So the plan is the following:
-
-
- Have 2 different DACs. We need it to have different caches, as viability settings are linked to cache.
-
public class DetailsTableA : IBqlTable { public abstract class fieldA: IBqlField { } [PXDBString(1)] [PXUIField(DisplayName = "Field A")] public virtual String FieldA { get; set; } }
-
public class DetailsTableB : IBqlTable { public abstract class fieldB: IBqlField { } [PXDBString(1)] [PXUIField(DisplayName = "Field B")] public virtual String FieldB { get; set; } }
-
- Have 2 different DataViews to link grids to different DACs.
- public PXFilter<DetailsTableA> DetailsViewA;
- public PXFilter<DetailsTableB> DetailsViewB;
- Have 2 different grids in the user interface.
- Have 2 different DACs. We need it to have different caches, as viability settings are linked to cache.
-
- In the RowSelected Event of Form choose one or another grid and using Cache.AllowSelect = true/false choose what grid should be visible.
public void MasterTable_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { MasterTable row = (MasterTable)e.Row; bool val = row == null || row.Status == "A"; DetailsViewA.Cache.AllowSelect = val; DetailsViewB.Cache.AllowSelect = !val; }
Acumatica will automatically sync grid visibility and hide/show grids dynamically.
You can see full code here:
Have a nice development!