我正在尝试在销售类别屏幕(IN204060)上添加与所选销售类别相关的细节网格
创建了一个保存网格数据的DAC:
public class INCategoryFilesCTC : IBqlTable
{
#region CategoryID
[PXDBInt(IsKey = true)]
[PXUIField(DisplayName = "Category ID")]
public virtual int? CategoryID { get; set; }
public abstract class categoryID : IBqlField { }
#endregion
#region Type
[PXDBString(1, IsFixed = true, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Type")]
public virtual string Type { get; set; }
public abstract class type : IBqlField { }
#endregion
#region NoteID
[PXNote()]
[PXUIField(DisplayName = "Price Source")]
public virtual Guid? NoteID { get; set; }
public abstract class noteID : IBqlField { }
#endregion
#region Uploaded
[PXDBDate()]
[PXUIField(DisplayName = "Uploaded")]
public virtual DateTime? Uploaded { get; set; }
public abstract class uploaded : IBqlField { }
#endregion
#region FileName
[PXDBString(50, IsFixed = true, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "File Name")]
public virtual string FileName { get; set; }
public abstract class fileName : IBqlField { }
#endregion
}
然后添加了一个数据视图委托Select Select(由于图形数据的其余标准选择,与Current<>有问题)
) public PXSelect<INCategoryFilesCTC> CategoryFiles;
protected virtual IEnumerable categoryFiles()
{
var cache = Base.Caches[typeof(INCategoryFilesCTC)];
cache.AllowInsert = true;
cache.AllowUpdate = true;
cache.AllowDelete = true;
var select = PXSelect<INCategoryFilesCTC,
Where<INCategoryFilesCTC.categoryID,
Equal<Required<INCategoryFilesCTC.categoryID>>>>.Select(Base,Base.Folders.Current.CategoryID).FirstTableItems;
foreach (INCategoryFilesCTC item in select)
{
cache.SetStatus(item,PXEntryStatus.Held);
}
return cache.Cached;
}
网格生活在一个拆分容器的1/2内,并在选项卡中。搜索ID =" WebFiles"(是一半居住的地方,认为我不会淹没你们使用ASPX代码的人,如果您想要其余的,请告诉我)
) <Template2>
<px:PXFormView ID="form" runat="server" DataSourceID="ds" DataMember="CurrentCategory"
Caption="Category Info" Width="100%">
<Template>
<px:PXLayoutRule ID="PXLayoutRule1" runat="server" StartColumn="True" LabelsWidth="S" ControlSize="SM" />
<px:PXTextEdit ID="edDescription" runat="server" DataField="Description" CommitChanges="True" />
<px:PXLayoutRule ID="PXLayoutRule2" runat="server" StartColumn="True" LabelsWidth="S" ControlSize="SM" />
<px:PXTreeSelector ID="edParentID" runat="server" DataField="ParentID" ShowRootNode="False"
TreeDataMember="ParentFolders" TreeDataSourceID="ds" AutoRefresh="True" ExpandDepth="1"
SyncPosition="True" DataMember="ParentFolders" AutoRepaint="True" CommitChanges="True" KeepPosition="True">
<DataBindings>
<px:PXTreeItemBinding DataMember="ParentFolders" TextField="Description" ValueField="CategoryID" />
</DataBindings>
</px:PXTreeSelector>
<px:PXLayoutRule ID="PXLayoutRule3" runat="server" StartColumn="True" LabelsWidth="S" ControlSize="SM" />
</Template>
</px:PXFormView>
<px:PXTab runat="server" >
<Items>
<px:PXTabItem Text="Category Members">
<Template>
<px:PXGrid ID="gridMembers" runat="server" ActionsPosition="Top" Width="100%"
SkinID="Details" CaptionVisible="true" SyncPosition="True"
AutoRepaint="True" AdjustPageSize="Auto">
<AutoSize Enabled="True" Container="Parent"/>
<Mode InitNewRow="True"></Mode>
<Levels>
<px:PXGridLevel DataMember="Members">
<Columns>
<px:PXGridColumn AllowCheckAll="True" AllowNull="False" DataField="CategorySelected" TextAlign="Center"
Type="CheckBox" Width="26px" />
<px:PXGridColumn DataField="InventoryID" CommitChanges="true" Width="140px" LinkCommand="viewDetails"/>
<px:PXGridColumn DataField="InventoryItem__Descr" Width="200px"/>
<px:PXGridColumn DataField="InventoryItem__ItemClassID" Width="140px"/>
<px:PXGridColumn AllowNull="False" DataField="InventoryItem__ItemStatus" RenderEditorText="True" Width="100px"/>
</Columns>
</px:PXGridLevel>
</Levels>
<ActionBar>
<Actions>
<Search Enabled="False" />
<EditRecord Enabled="False" />
<NoteShow Enabled="False" />
<FilterShow Enabled="False" />
<FilterSet Enabled="False" />
<ExportExcel Enabled="False" />
</Actions>
<CustomItems>
<px:PXToolBarButton Tooltip="Copy Selected Inventory Items" DisplayStyle="Image">
<AutoCallBack Command="Copy" Enabled="True" Target="ds" />
<Images Normal="main@Copy" />
</px:PXToolBarButton>
<px:PXToolBarButton Tooltip="Cut Selected Inventory Items" DisplayStyle="Image">
<AutoCallBack Command="Cut" Enabled="True" Target="ds" />
<Images Normal="main@Cut" />
</px:PXToolBarButton>
<px:PXToolBarButton Tooltip="Paste Inventory Items from Buffer" DisplayStyle="Image">
<AutoCallBack Command="Paste" Enabled="True" Target="ds" />
<Images Normal="main@Paste" />
</px:PXToolBarButton>
<px:PXToolBarButton>
<AutoCallBack Command="AddItemsbyClass" Target="ds" />
</px:PXToolBarButton>
<px:PXToolBarButton Text="Inventory Details" Key="cmdviewDetails" Visible="False">
<AutoCallBack Command="viewDetails" Target="ds" />
</px:PXToolBarButton>
</CustomItems>
</ActionBar>
</px:PXGrid>
</Template>
</px:PXTabItem>
<px:PXTabItem Text="Website Media">
<template>
<px:PXFormView ID="WebForm" runat="server" DataSourceID="ds" DataMember="CurrentCategory">
<Template>
<px:PxTextEdit ID="txtVideoURL" runat="server" DataField="CTCVideoURL" />
<px:PxTextEdit ID="txtCategoryDesc" runat="server" DataField="CTCCategoryDesc" />
</Template>
</px:PXFormView>
<px:PXGrid ID="WebFiles" runat="server" FilesIndicator="True" Height="300px" Width="100%" DataSourceID="ds">
<Levels>
<px:PXGridLevel DataMember="CategoryFiles" DataKeyNames="CategoryID">
<Columns>
<px:PXGridColumn DataField="CategoryID" />
<px:PXGridColumn DataField="Type" />
<px:PXGridColumn DataField="Filename" />
<px:PXGridColumn DataField="Uploaded"/>
</Columns>
</px:PXGridLevel>
</Levels>
<ActionBar>
<Actions>
<Delete Enabled="True" />
<AddNew Enabled="True" />
</Actions></ActionBar>
</px:PXGrid>
</template>
</px:PXTabItem>
</Items>
</px:PXTab>
</Template2>
当我选择一个树元素时,如果有记录会显示在我的自定义表中(树元素categoryId = grid record egatoryId),我会收到以下错误:
Error: an invalid argument has been specified
Parameter name selectParent
绝对没有任何痕迹出现,在调试期间什么也没有出现,所以我有点损失。
几件事:
当我评论自定义PXGRID时,错误也会消失,即使我添加了
的选项卡和组,也可以正常使用屏幕如果我评论pxparent和pxdbdefault属性,则该错误不会消失。
如果所选树选择没有详细记录,则没有错误。如果我制作记录并保存记录,则出现错误(现在插入的记录现在显示在网格中,并且在数据库表中保存的详细记录)
这使我相信选择详细记录中正在发生一些事情。有建议吗?
谢谢-Kyle
好吧,事实证明这比我想象的更基本。如果您想跳过阅读,结果是由于详细信息记录上的一个简单关键问题
首先,我删除了数据视图代表,"当前"销售类别ID是通过Fine
出现的 public PXSelect<INCategoryFilesCTC,
Where<INCategoryFilesCTC.categoryID,
Equal<Current<INCategory.categoryID>>>> CategoryFiles;
第二,添加了Master-Detail链接的正确的PXPARENT和PXDBDEFAULT属性(on Field categoryId)
#region CategoryID
[PXDBInt(IsKey=true)]
[PXParent(typeof(Select<INCategory, Where<INCategory.categoryID, Equal<Current<INCategory.categoryID>>>>))]
[PXDBDefault(typeof(INCategory.categoryID))]
public virtual int? CategoryID { get; set; }
public abstract class categoryID : IBqlField { }
#endregion
,但最后我添加了一个使用属性[pxlinenbr]
的行#样式列#region CatFileKey
[PXDBInt(IsKey=true)]
[PXLineNbr(typeof(INCTC001INCategory.ctcPrevFileNumber))]
public virtual int? CatFileKey { get; set; }
public abstract class carFileKey : IBqlField { }
#endregion
让第二个键立即解决我的问题
所以总的来说,我认为是由于某些困难的定制而造成的错误,实际上是因为某些极其基本的事情哈哈..希望这篇文章可以防止人们忘记同一件事