Acumatica:数据更改时,显示消息“离开站点?”不会出现“您所做的更改可能不会保存”以防止丢失更改

问题描述 投票:0回答:2

通常,在所有Acumatica页面中,进行更改时,框架都会向您抛出标准的javascript消息:“所做的更改可能不会保存”,以防止您丢失更改:

enter image description here

enter image description here

什么设置导致此行为?我有一个屏幕,那里没有这样的对话框,我也不知道如何引起这种情况。

此有问题的页面是一个弹出窗口:enter image description here

使用时打开此弹出窗口当使用PXRedirectRequiredException打开弹出窗口时,不会发生此问题:

throw new PXPopupRedirectException(currentPayCalendarMaint, true, string.Empty);

PXRedirectRequiredException打开时:

throw new PXRedirectRequiredException(currentPayCalendarMaint, true, string.Empty);

该框架会在常规浏览器弹出窗口中打开对话框,并按预期方式显示要求的消息(“所做的更改可能不会保存”):

enter image description here

如果不将弹出窗口作为单独的窗口打开,是否有可能具有所要求的行为?

我将感谢您的任何帮助或建议。

c# asp.net acumatica
2个回答
1
投票

我相信在正常情况下,这直接与图形上的IsDirty标志或图形中的缓存相关联。更改任何缓存中的值时,图形的IsDirty标志将设置为true。我已经看到了一些代码,这些代码在特定缓存上手动将IsDirty设置为false,从而导致您所描述的问题。可能发生了这种情况,但是您的代码也可能实际上未更新任何缓存中的任何值。没有您的代码,我只能推测。

来自在PX.Data.PXGraph中定义IsDirty的源代码的注释:

// Summary:
//     Gets the value that indicates whether there are modified data records not saved
//     to the database in the caches related to the graph data views. If the IsDirty
//     property of at least one cache object is true, the IsDirty property of the graph
//     is also true.
public virtual bool IsDirty { get; }

摘自SOCreateShipment的摘录,其中使用了Orders的构造函数:

[PXFilterable]
public PXFilteredProcessing<SOOrder, SOOrderFilter> Orders;
...

public virtual IEnumerable orders()
{
    PXUIFieldAttribute.SetDisplayName<SOOrder.customerID>(Caches[typeof(SOOrder)], Messages.CustomerID);
    ...
    PXView.StartRow = 0;

    Orders.Cache.IsDirty = false;
}

1
投票

目前,解决问题的唯一方法是在新的标准浏览器窗口中打开,如下所示:enter image description here代替Aucmatica对话框:enter image description here

要实现这一点,我们需要打开以下对话框:

throw new PXRedirectRequiredException(currentPayCalendarMaint, true, string.Empty)
            {
                Mode = PXBaseRedirectException.WindowMode.NewWindow
            };

代替此:

throw new PXPopupRedirectException(currentPayCalendarMaint, string.Empty, true);
© www.soinside.com 2019 - 2024. All rights reserved.