【问题标题】:Acumatica: when the data changed, message "leave site?" "Changes you made may not be saved" doesn't appear to prevent loosing the changesAcumatica:当数据发生变化时,提示“离开站点?” “您所做的更改可能无法保存”似乎无法防止丢失更改
【发布时间】:2020-08-11 18:55:18
【问题描述】:

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

什么设置导致了这种行为? 我有一个没有这样的对话框的屏幕,我不知道如何导致它发生。

这个有问题的页面是一个弹出窗口:

使用时打开此弹出窗口当您使用PXRedirectRequiredException 打开弹出窗口时不会出现此问题:

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

当你用PXRedirectRequiredException打开它时:

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

框架以常规浏览器弹出窗口的形式打开对话框,并按预期显示所需的消息(“您所做的更改可能无法保存”):

是否可以在不将弹出窗口作为单独窗口打开的情况下获得所需的行为?

如果有任何帮助或建议,我将不胜感激。

【问题讨论】:

    标签: c# asp.net acumatica


    【解决方案1】:

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

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

    // 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; }
    

    使用 Orders 构造函数的 SOCreateShipment 节选:

    [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;
    }
    

    【讨论】:

    • 感谢您分享您的知识。在我的情况下,一个图打开另一个图,问题出在 PXPopupRedirectException 中。当您使用 PXRedirectRequiredException 打开弹出窗口时,不会发生此问题。
    • 感谢您添加更多详细信息。看起来 Hughes(又名 HB_Acumatica)会知道,但这超出了我的范围。
    • 我验证了:在我的情况下,缓存 IsDirty 是真的,所以它看起来像是 PXPopupRedirectException 的限制。它不需要保存,因为可能这个新对话框被认为是在相同的上下文中。所以唯一的方法是在新对话框中打开,直到 Acumatica 解决这个问题。
    【解决方案2】:

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

    为此,我们需要打开对话框:

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

    而不是这个:

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

    【讨论】:

      猜你喜欢
      • 2020-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-18
      • 2010-12-07
      • 2017-04-24
      • 2021-08-07
      • 2017-03-26
      相关资源
      最近更新 更多