【问题标题】:Show popup or smart dialog once on screen load在屏幕加载时显示弹出窗口或智能对话框一次
【发布时间】:2020-02-20 00:32:17
【问题描述】:

每当屏幕第一次为每条记录加载时,我想向用户显示一个带有一些消息的弹出窗口。

例如,当为特定销售订单加载销售订单屏幕时,它应该只显示一次弹出窗口。然后用户导航到下一个销售订单,它应该再次显示该特定销售订单的弹出窗口一次。

我已经在构造函数和 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();
}

【问题讨论】:

  • 谁能推荐一下?

标签: acumatica


【解决方案1】:

尝试在修改主 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');

【讨论】:

  • 我已经尝试过FieldUpdatedFieldUpdatingFieldSelecting 事件。当我浏览案例时,第一次加载案例屏幕时,它们都没有被执行。
猜你喜欢
  • 1970-01-01
  • 2020-12-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-13
相关资源
最近更新 更多