我创建了一个新表,它是供应商的子表。在这里,我想为每个供应商存储一些日期。下面是表结构(其中CompanyID和RecordID是PrimaryKey,RecordID是带种子1的Identity) -
CREATE TABLE [dbo].[VendorClosedDates](
[CompanyID] [int] NOT NULL,
[RecordID] [int] IDENTITY(1,1) NOT NULL,
[VendorID] [int] NOT NULL,
[VendorCloseDate] [datetime] NOT NULL,
[tstamp] [timestamp] NOT 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,
CONSTRAINT [PK_VendorClosedDates] PRIMARY KEY CLUSTERED
(
[CompanyID] ASC,
[RecordID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
基于此,我创建了一个带有dataview的自定义项目,并添加了一个带有网格的新选项卡,以显示新表中的所有日期(仅1列)。根据我浏览的供应商,这些网格应该刷新并仅向我显示相关数据。但是,出于某种原因,它并不令人耳目一新,甚至没有显示任何数据。下面是截图和一些代码片段,以帮助理解我的代码是如何实现的。可能是我错过了什么。
网格代码 -
<px:PXTabItem Text="Closed Dates">
<Template>
<px:PXGrid runat="server" ID="CstPXGrid79" DataSourceID="ds" SkinID="DetailsInTab" Height="150px" Width="100%" AdjustPageSize="Auto" AllowPaging="True">
<Levels>
<px:PXGridLevel DataMember="ClosedDates">
<Columns>
<px:PXGridColumn DataField="VendorCloseDate" Width="90" /></Columns>
<RowTemplate>
<px:PXDateTimeEdit runat="server" ID="CstPXDateTimeEdit82" DataField="VendorCloseDate" /></RowTemplate></px:PXGridLevel></Levels>
<Mode AllowAddNew="True" AllowDelete="True" AllowUpdate="True" />
<AutoSize MinHeight="1000" /></px:PXGrid></Template></px:PXTabItem>
DAC片段 -
#region RecordID
public abstract class recordID : PX.Data.IBqlField
{
}
protected int? _RecordID;
[PXDBIdentity(IsKey = true)]
public virtual int? RecordID
{
get
{
return this._RecordID;
}
set
{
this._RecordID = value;
}
}
#endregion
#region VendorID
public abstract class vendorID : PX.Data.IBqlField
{
}
protected int? _VendorID;
[PXDBInt()]
[PXDefault(typeof(Vendor.bAccountID))]
public virtual int? VendorID
{
get
{
return this._VendorID;
}
set
{
this._VendorID = value;
}
}
#endregion
#region VendorCloseDate
public abstract class vendorCloseDate : PX.Data.IBqlField
{
}
protected DateTime? _VendorCloseDate;
[PXDBDate()]
[PXUIField(DisplayName = "Vendor Close Date")]
public virtual DateTime? VendorCloseDate
{
get
{
return this._VendorCloseDate;
}
set
{
this._VendorCloseDate = value;
}
}
#endregion
VendorMaint扩展下的Dataview和Vendor_RowSelecting事件 -
[PXViewName("ClosedDates")]
public PXSelect<VendorClosedDates,
Where<VendorClosedDates.vendorID, Equal<Current<Vendor.bAccountID>>>> ClosedDates;
protected virtual void Vendor_RowSelecting(PXCache cache, PXRowSelectingEventArgs e)
{
ClosedDates.View.RequestRefresh();
}
任何建议。
答案 0 :(得分:0)
除了两件事之外,一切看起来都很好:
PXGrid.AutoSize缺少已启用属性设置为$('.ion-close-round').on('click', function () {
$('.modal').css("display", "block");
});
(我还建议将MinHeight更改为200,因为1000可以更多)
在RowSelected处理程序中绝对不必要地使用RequestRefresh方法 - 必须从BLC扩展中删除它:
True
另外,我还建议在VendorClosedDates DAC中的VendorID字段上用PXDBDefault替换PXDefault属性,并另外用PXParent属性修饰VendorID:
protected virtual void Vendor_RowSelecting(PXCache cache, PXRowSelectingEventArgs e)
{
ClosedDates.View.RequestRefresh();
}
Vendor.BAccountID字段映射到标识列。在这种情况下,需要使用PXDBDefault属性,否则不会使用数据库生成的新Vendor.BAccountID值更新VendorClosedDates.VendorID字段。
从应用程序中删除供应商时,必须使用PXParentAttribute来级联删除VendorClosedDates记录