gpt4 book ai didi

acumatica - 如何创建超链接用户字段

转载 作者:行者123 更新时间:2023-12-04 22:45:52 25 4
gpt4 key购买 nike

我有一个显示 ARRegister.RefNbr 的用户字段。该用户字段包含在 APTran 网格中。用户实际使用自定义操作创建 AR 发票,并将新的 AR 文档引用 nbr 保存到 APTran 网格中。我希望将用户字段制作为超链接(类似于 SO 发货订单选项卡中的库存收据引用编号)。我应该使用 PXSelector 控件吗?什么是适当的属性?目标是在用户单击用户字段时打开 AR 发票屏幕。

最佳答案

有一种通用方法可以让您添加到网格单元的链接,而不是基于选择器或其他任何东西。要实现它,您必须执行以下步骤:

1.在您的图表中定义处理重定向的操作。像这样的东西:

public PXAction<YourMainDAC> ViewInvoice;

[PXButton]
protected virtual void viewInvoice()
{
ARTran row = Transactions.Current;
string docType = //get Doc Type from the tran record
string refNbr = //get Ref Nbr from the tran record
ARInvoice invoice = PXSelect<ARInvoice,
Where<ARInvoice.docType, Equal<Required<ARInvoice.docType>>,
And<ARInvoice.refNbr, Equal<Required<ARInvoice.refNbr>>>>>
.Select(this, row.YourDocTypeField, row.YourRefNbrField);

// Create the instance of the destination graph
ARInvoiceEntry graph = PXGraph.CreateInstance<ARInvoiceEntry>();
graph.Document.Current = invoice;

// If the invoice is found, throw an exception to open
// a new window (tab) in the browser
if (graph.Document.Current != null)
{
throw new PXRedirectRequiredException(graph, true, "AR Invoice");
}
}

2.在.aspx页面定义中添加对应新 Action 的回调命令(将 grid替换为你页面上的 ARTran网格的ID):
<px:PXDataSource ID="ds" ... >
<CallbackCommands>
<px:PXDSCallbackCommand Name="ViewInvoice"
Visible="False"
DependOnGrid="grid">
</px:PXDSCallbackCommand>
</CallbackCommands>
</px:PXDataSource>

3.在要添加链接的网格列中指定链接命令指向上面的 PXDSCallbackCommand :
<px:PXGridColumn DataField="InvoiceNbrOrSomething"
LinkCommand="ViewInvoice">
</px:PXGridColumn>

这种定义链接的方式有点冗长,但首先,它不会对添加链接的字段强加任何限制,而且它还使您可以完全控制要打开的图形以及在那里显示的内容。

注意:您可能还需要在 aspx 中的网格控件上设置 SyncPosition="true"

该示例改编自 Acumatica T200 培训指南中的示例 3.4。您可能需要查看它以获得一些详尽的解释和更多信息。

关于acumatica - 如何创建超链接用户字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26387291/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com