我在Stock Items页面上创建了一个视图,该视图显示与正在查看的项目具有相同项目类别的所有项目。视图显示正确,但当前属性不正确。出于某种原因,relatedItems.Current
记录始终是页面上当前的项目,而不是网格中正在选择的项目。
我在ASPX页面上有回调函数,而InventoryCD
LinkCommand调用了这个函数。有什么奇怪的是我在Item Classes屏幕上有相同的代码,它完美无缺。
我的自定义视图的Current
属性始终是单击的记录。我为网格设置了SyncPosition
设置为true。可能会出现问题,因为我在InventoryItem
上引用了InventoryItem
吗?谢谢
public class InventoryItemMaint_Extension : PXGraphExtension<InventoryItemMaint>
{
#region Event Handlers
public PXSelectReadonly<InventoryItem, Where<InventoryItem.itemClassID, Equal<Current<InventoryItem.itemClassID>>, And<InventoryItem.inventoryID, NotEqual<Current<InventoryItem.inventoryID>>>>> relatedItems;
public PXAction<InventoryItem> ViewCurrentItem;
[PXButton]
protected virtual void viewCurrentItem()
{
InventoryItem row = relatedItems.Current;
// Create the instance of the destination graph
InventoryItemMaint graph = PXGraph.CreateInstance<InventoryItemMaint>();
graph.Item.Current = row;
if (graph.Item.Current != null)
{
throw new PXRedirectRequiredException(graph, true, "Item");
}
}
}
答案 0 :(得分:0)
请在页面中验证您是否为您的操作指定了DependOnGrid
属性: -
<CallbackCommands>
...
<px:PXDSCallbackCommand Name="ViewCurrentItem" Visible="true" DependOnGrid="RelatedGridID" />
</CallbackCommands>
属性在T200培训材料中解释
备用选项是利用PXSelector的AllowEdit - 您不需要自定义操作。
实施例
<px:PXGrid … >
<Levels>
<px:PXGridLevel …>
<Columns>
…
</Columns>
<RowTemplate>
<px:PXSegmentMask runat="server" ID="CstPXSegmentMask2" DataField="InventoryCD" AllowEdit="True" />
</RowTemplate>
</px:PXGridLevel>
</Levels>
</px:PXGrid>
要更改同一页面中的项目,
除非您想在多个容器控件中显示相同的数据记录,否则每个数据视图都应引用唯一的主数据访问类(DAC)。有了这个,您需要创建一个新的DAC来表示从InventoryItem
继承的相关项,并为BQL语句中使用的派生类的数据字段定义新的抽象类。
[Serializable]
public class RelatedInventoryItem : InventoryItem
{
public new abstract class inventoryID : IBqlField { };
public new abstract class itemClassID : IBqlField { };
}
您的数据视图应为
public PXSelectReadonly<RelatedInventoryItem,
Where<RelatedInventoryItem.itemClassID,
Equal<Current<InventoryItem.itemClassID>>,
And<RelatedInventoryItem.inventoryID,
NotEqual<Current<InventoryItem.inventoryID>>>>>
relatedItems;
答案 1 :(得分:0)
@DChhapgar是的,我正确设置了DependOnGrid。这是所有相关代码:
iterator()
使用<px:PXDSCallbackCommand Name="ViewRelatedItems" Visible="true" DependOnGrid="relatedItemsGridID" /></CallbackCommands>
....
<px:PXTabItem Text="Related Items">
<Template>
<px:PXGrid runat="server" ID="relatedItemsGridID" SkinID="DetailsInTab" Width="100%" SyncPosition="True" DataSourceID="ds" >
<Levels>
<px:PXGridLevel DataMember="relatedItems">
<Columns>
<px:PXGridColumn DataField="InventoryCD" Width="100" LinkCommand="ViewRelatedItems"/>
<px:PXGridColumn DataField="InventoryID" Width="100" />
<px:PXGridColumn DataField="ItemClassID" Width="100" />
<px:PXGridColumn DataField="Descr" Width="200" />
<px:PXGridColumn DataField="ItemStatus" Width="100" />
<px:PXGridColumn DataField="ItemType" Width="100" />
<px:PXGridColumn DataField="KitItem" Width="60" /></Columns>
</px:PXGridLevel></Levels>
<AutoSize Enabled="True" MinHeight="200" />
<Mode AllowAddNew="False" AllowDelete="False" AllowUpdate="False" /></px:PXGrid></Template></px:PXTabItem>
....
的{{1}}有效,但我想更改同一页面中的项目,因此理想情况下,用户会点击该项目,即库存ID /库存CD字段。将使用单击的项填充标头,并提交更改。