Reputation: 1311
So I added a new tab in my Sales Order screen mean to show INItemXRef records - the cross references data. I added an action to display the current record. The graph customisation as follows :
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
public PXSelect<INItemXRef> substituteProducts;
public PXAction<SOOrder> showAlt;
[PXUIField(DisplayName = "Show Alt")]
[PXButton]
public virtual void ShowAlt()
{
substituteProducts.Ask($"Current AltID : {substituteProducts.Current.AlternateID}",MessageButtons.OK);
}
}
My asp :
<px:PXTabItem Text="Subs">
<Template>
<px:PXGrid runat="server" ID="gridSubs" Width="100%" SkinID="Inquire" SyncPosition="True" MatrixMode="True" DataSourceID="ds">
<Levels>
<px:PXGridLevel DataMember="substituteProducts">
<Columns>
<px:PXGridColumn DataField="AlternateID" Width="180" />
</Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Enabled="True" MinHeight="400" />
<ActionBar>
<CustomItems>
<px:PXToolBarButton DependOnGrid="gridSubs" CommandSourceID="ds" CommandName="ShowAlt" />
</CustomItems>
</ActionBar>
</px:PXGrid>
</Template>
</px:PXTabItem>
When I try to access the "current" record of my view. Its always pointing to the top record for some reason. I can't see any difference with other screens where it works.
So I tried to change the table and column and the rest remains the same.
//public PXSelect<INItemXRef> substituteProducts;
public PXSelect<BAccount> substituteProducts;
public PXAction<SOOrder> showAlt;
[PXUIField(DisplayName = "Show Alt")]
[PXButton]
public virtual void ShowAlt()
{
substituteProducts.Ask($"Current AltID : {substituteProducts.Current.AcctCD}",MessageButtons.OK);
//substituteProducts.Ask($"Current AltID : {substituteProducts.Current.AlternateID}",MessageButtons.OK);
}
And surprisingly it works as expected. Proving that my grid is configured properly.
So what's going on here ? Is the issue unique for INItemXRef ?
TIA
Upvotes: 0
Views: 154
Reputation: 2271
When the Current record of the grid does not update correctly, I find that it is one of the following reasons:
In your case, I can see that SyncPosition has been set. Also, the DAC should have its IsKey property set as well. Can you therefore check if INItemXRef is used in another data view of the graph please? How Acumatica Cache layer works it is not possible to re-use the same DAC in multiple views and have different data/Current property.
As a workaround, you could create a new DAC, possibly by using a PXProjection based on INItemXRef.
Upvotes: 1