我在库存项目页面上创建了一个视图,该视图显示与正在查看的项目具有相同项目类别的所有项目。该视图正确显示,但当前属性不正确。出于某种原因,relatedItems.Current
记录始终是当前页面上的项目,而不是在网格中选择的项目。自定义视图的当前属性没有正确更新
我有ASPX页面的回调函数和InventoryCD
LinkCommand调用这个函数。奇怪的是,我在“项目类别”屏幕上显示了相同的代码,并且它完美地工作。
我自定义视图的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");
}
}
}
我已更新原始答案。 – DChhapgar