每当每条记录首次加载屏幕时,我想向用户显示一个带有一些消息的弹出窗口。
例如,当为特定销售订单加载"销售订单"屏幕时,它应仅显示一次弹出窗口。然后用户导航到下一个销售订单,它应该再次仅显示该特定销售订单的弹出窗口一次。
我已经在构造函数和 RowSelected 事件中编写了代码,但它没有当前记录。也就是说CRCurrentCaseNotes
在这两个事件中始终为 null。但是,使用按钮(ViewNotes
下面的代码示例中(,它可以工作。
[PXViewName("CRCurrentCaseNotes")]
[PXCopyPasteHiddenView]
public PXSelect<Note,
Where<CRCase.caseID, Equal<Current<CRCase.caseID>>>> CRCurrentCaseNotes;
public CRCaseMaintExtension()
: base()
{
if (CRCurrentCaseNotes.Current != null)
{
CRCurrentCaseNotes.AskExt();
}
}
protected virtual void CRCase_RowSelecting(PXCache cache, PXRowSelectingEventArgs e)
{
var caseRow = (CRCase)e.Row;
if (caseRow == null) return;
if (CRCurrentCaseNotes.Current != null)
{
CRCurrentCaseNotes.AskExt();
}
}
// SAME CODE WORKS WITH THE BUTTON CLICK
public PXAction<CRCase> viewNotes;
[PXUIField(DisplayName = "View Notes")]
[PXButton]
protected virtual IEnumerable ViewNotes(PXAdapter adapter)
{
if (CRCurrentCaseNotes.Current != null)
{
CRCurrentCaseNotes.AskExt();
}
return adapter.Get();
}
尝试在修改主 DAC 键字段时显示对话框:
protected void CRCase_CaseID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
CRCase case = e.Row as CRCase;
if (case != null && case.CaseID != null && !e.ExternalCall)
{
// Show dialog
}
}
如果没有其他方法可以使用JavaScript来显示/隐藏SmartPanel:
document.getElementById("<%=SmartPanelID.ClientID %>").style.display = 'block';
编辑:
对话框只能从操作事件处理程序(FieldUpdated 不起作用(或 JavaScript 显示。要在页面打开时打开对话框,您可以尝试在 JavaScript 中挂钩 DocumentReady 事件,并从 JavaScript 调用 Acumatica 操作:px_alls['ds'].executeCallback('ActionName'(;