Skip to main content
Answer

Custom form with tabs, grid in each tab, grid not saving

  • May 10, 2024
  • 4 replies
  • 244 views

Joe Schmucker
Captain II
Forum|alt.badge.img+3

I have a custom screen with 3 tabs.  I created it using the Tab (Tab View) template.

The form looks great and displays the data in my 3 tabs, one grid in each tab.

When I change a record in one of the grids, the Save icon becomes enabled, but when I click the Save icon, it does not do anything.

This is Acumatica 101, but I could use help to get this working.

Here is my Graph:

	public class ICSPreferences : PXGraph<ICSPreferences>
{

public PXSave<MasterTable> Save;
public PXCancel<MasterTable> Cancel;

public PXFilter<MasterTable> MasterView;

public PXSelect<ICSDistrictsPref> DistrictsView;
public PXSelect<ICSOwnershipGroupPref> OwnershipGroupView;
public PXSelect<ICSESGPref> ESGView;


[Serializable]
public class MasterTable : IBqlTable
{

}
}

Here is my ASPX:

<%@ Page Language="C#" MasterPageFile="~/MasterPages/TabView.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="IC202070.aspx.cs" Inherits="Page_IC202070" Title="Untitled Page" %>
<%@ MasterType VirtualPath="~/MasterPages/TabView.master" %>

<asp:Content ID="cont1" ContentPlaceHolderID="phDS" Runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%"
TypeName="MyPlace23R1.ICSPreferences"
PrimaryView="MasterView"
>
<CallbackCommands>

</CallbackCommands>
</px:PXDataSource>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phF" Runat="Server">
<px:PXTab ID="tab" runat="server" DataSourceID="ds" Height="150px" Style="z-index: 100" Width="100%" AllowAutoHide="false">
<Items>
<px:PXTabItem Text="Ownership Groups">

<Template>
<px:PXGrid Width="100%" AllowAutoHide="false" DataSourceID="ds" Height="150px" SkinID="Details" runat="server" ID="CstOwnershipGrid">
<Levels>
<px:PXGridLevel DataMember="OwnershipGroupView" >
<Columns>
<px:PXGridColumn DataField="OwnershipGroup" Width="220" ></px:PXGridColumn>
<px:PXGridColumn Type="CheckBox" TextAlign="Center" DataField="IsActive" Width="60" ></px:PXGridColumn></Columns></px:PXGridLevel></Levels>
<AutoSize Container="Window" ></AutoSize>
<AutoSize Enabled="True" ></AutoSize>
<AutoSize MinHeight="150" ></AutoSize>
<ActionBar>
<Actions>
<Delete Enabled="False" /></Actions></ActionBar></px:PXGrid></Template></px:PXTabItem>
<px:PXTabItem Text="Districts">

<Template>
<px:PXGrid Width="100%" AllowAutoHide="false" DataSourceID="ds" Height="150px" SkinID="Details" runat="server" ID="CstDistrictsGrid">
<Levels>
<px:PXGridLevel DataMember="DistrictsView" >
<Columns>
<px:PXGridColumn DataField="Districts" Width="220" ></px:PXGridColumn>
<px:PXGridColumn TextAlign="Center" Type="CheckBox" DataField="IsActive" Width="60" ></px:PXGridColumn></Columns></px:PXGridLevel></Levels>
<AutoSize Container="Window" ></AutoSize>
<AutoSize Enabled="True" ></AutoSize>
<AutoSize MinHeight="150" ></AutoSize>
<ActionBar>
<Actions>
<Delete Enabled="False" /></Actions></ActionBar></px:PXGrid></Template></px:PXTabItem>
<px:PXTabItem Text="ESG" >
<Template>
<px:PXGrid Width="100%" AllowAutoHide="false" DataSourceID="ds" Height="150px" SkinID="Details" runat="server" ID="CstESGGrid">
<Levels>
<px:PXGridLevel DataMember="ESGView" >
<Columns>
<px:PXGridColumn DataField="ESG" Width="220" ></px:PXGridColumn>
<px:PXGridColumn Type="CheckBox" TextAlign="Center" DataField="IsActive" Width="60" ></px:PXGridColumn></Columns></px:PXGridLevel></Levels>
<AutoSize Container="Window" ></AutoSize>
<AutoSize Enabled="True" ></AutoSize>
<AutoSize MinHeight="150" ></AutoSize>
<ActionBar>
<Actions>
<Delete Enabled="False" /></Actions></ActionBar></px:PXGrid></Template></px:PXTabItem></Items>
<AutoSize Container="Window" Enabled="True" MinHeight="200" ></AutoSize>
</px:PXTab>
</asp:Content>

This is what the screen looks like:

 

I think it has to do with the PXFilter on an empty Master table, but I don’t know what the solution is.

Best answer by Patrick Chen

Hmmm, that all looks correct.  I think the primary DAC of the graph, MasterTable, being an empty object is your problem.  I imagine that halts the Save process.

4 replies

Patrick Chen
Varsity II
Forum|alt.badge.img+2

Hey Joe, Are you sure your 3 custom DACs have a stated primary key?


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • May 10, 2024

Hi Patrick,

Here is one of the DACs

	[Serializable]
[PXCacheName("ICS Ownership Group Pref")]
[PXPrimaryGraph(typeof(ICSPreferences))]

public class ICSOwnershipGroupPref : IBqlTable
{
#region OwnershipGroup
[PXDBString(100, IsUnicode = true, IsKey = true, InputMask = "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC")]
[PXUIField(DisplayName = "Ownership Group", Enabled = true)]
public virtual string OwnershipGroup { get; set; }
public abstract class ownershipGroup : PX.Data.BQL.BqlString.Field<ownershipGroup> { }
#endregion

#region IsActive
[PXDBBool]
[PXDefault(true, PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Active", Enabled = true)]
public virtual bool? IsActive { get; set; }
public abstract class isActive : PX.Data.BQL.BqlBool.Field<isActive> { }
#endregion


#region CreatedByID
[PXDBCreatedByID()]
public virtual Guid? CreatedByID { get; set; }
public abstract class createdByID : PX.Data.BQL.BqlGuid.Field<createdByID> { }
#endregion

#region CreatedByScreenID
[PXDBCreatedByScreenID()]
public virtual string CreatedByScreenID { get; set; }
public abstract class createdByScreenID : PX.Data.BQL.BqlString.Field<createdByScreenID> { }
#endregion

#region CreatedDateTime
[PXDBCreatedDateTime()]
public virtual DateTime? CreatedDateTime { get; set; }
public abstract class createdDateTime : PX.Data.BQL.BqlDateTime.Field<createdDateTime> { }
#endregion

#region LastModifiedByID
[PXDBLastModifiedByID()]
public virtual Guid? LastModifiedByID { get; set; }
public abstract class lastModifiedByID : PX.Data.BQL.BqlGuid.Field<lastModifiedByID> { }
#endregion

#region LastModifiedByScreenID
[PXDBLastModifiedByScreenID()]
public virtual string LastModifiedByScreenID { get; set; }
public abstract class lastModifiedByScreenID : PX.Data.BQL.BqlString.Field<lastModifiedByScreenID> { }
#endregion

#region LastModifiedDateTime
[PXDBLastModifiedDateTime()]
public virtual DateTime? LastModifiedDateTime { get; set; }
public abstract class lastModifiedDateTime : PX.Data.BQL.BqlDateTime.Field<lastModifiedDateTime> { }
#endregion

#region Tstamp
[PXDBTimestamp()]
public virtual byte[] Tstamp { get; set; }
public abstract class tstamp : PX.Data.BQL.BqlByteArray.Field<tstamp> { }
#endregion

#region Noteid
[PXNote()]
public virtual Guid? Noteid { get; set; }
public abstract class noteid : PX.Data.BQL.BqlGuid.Field<noteid> { }
#endregion


}

And this is the SQL script I used to create the table:

CREATE TABLE [dbo].[ICSOwnershipGroupPref](
[CompanyID] [int] NOT NULL,
[OwnershipGroup] [nvarchar](100) NOT NULL,
[IsActive] [bit] NULL,
[CreatedByID] [uniqueidentifier] NOT NULL,
[CreatedByScreenID] [char](8) NOT NULL,
[CreatedDateTime] [datetime] NOT NULL,
[LastModifiedByID] [uniqueidentifier] NOT NULL,
[LastModifiedByScreenID] [char](8) NOT NULL,
[LastModifiedDateTime] [datetime] NOT NULL,
[tstamp] [timestamp] NOT NULL,
[NoteID] [uniqueidentifier] NULL,
CONSTRAINT [ICSOwnershipGroupPref_PK] PRIMARY KEY CLUSTERED
(
[CompanyID] ASC,
[OwnershipGroup] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ICSOwnershipGroupPref] ADD DEFAULT ((0)) FOR [CompanyID]
GO

They look good to me, but maybe I’m missing something really dumb here.

 


Patrick Chen
Varsity II
Forum|alt.badge.img+2
  • Varsity II
  • Answer
  • May 10, 2024

Hmmm, that all looks correct.  I think the primary DAC of the graph, MasterTable, being an empty object is your problem.  I imagine that halts the Save process.


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • May 10, 2024

I’m just splitting it into three maintenance screens.  It would be nice to have one screen with three tabs, but in the essence of getting the project out the door, I’m just doing three screens.