【问题标题】:Losing updated records in cache when changing page更改页面时丢失缓存中的更新记录
【发布时间】:2018-10-16 03:02:21
【问题描述】:

我正在扩展 GL404000 屏幕,我遇到了以下问题:

当我在第一页选择几条记录时:

我可以在更新的缓存中轻松检索它们:

但是当点击网格部分的“下一页”时,这些记录会从更新的缓存中消失。然而,当我点击“上一页”时,“已选择”状态仍然存在,所以它必须存储在缓存中的某个位置,但我不知道在哪里。

我的目标是能够检索此屏幕上的每条选定记录,以便我可以全部处理它们。即使它们不再显示在页面上。

我错过了什么?

问候

【问题讨论】:

  • 应该是软件bug。举报吧。
  • 它看起来不像是软件错误,“selected”属性必须存储在某个地方,因为我在浏览上一页时仍然可以看到勾选的复选框,我只是不知道它存储在哪里以及如何存储访问它。

标签: acumatica


【解决方案1】:

如果您尝试在扩展程序上的自定义按钮中检索“选定”项目,您可以使用以下代码获得正确的结果:

public class AccountByPeriodEnqExtension : PXGraphExtension<AccountByPeriodEnq>
{
    public PXAction<AccountByPeriodFilter> RetrieveSelected;

    [PXButton(CommitChanges = true)] //Must be true for button press to post modifications to the server
    [PXUIField(DisplayName = "Retrieve Selected")]
    public virtual IEnumerable retrieveSelected(PXAdapter adapter)
    {
        List<GLTranR> items = new List<GLTranR>();
        foreach (GLTranR item in Base.GLTranEnq.SearchAll<Asc<GLTranR.selected>>(new object[] { true }, new object[] { }))
        {
            items.Add(item);
        }

        return adapter.Get();
    }
}

【讨论】:

  • 我这样做了:List transactions = new List(); foreach (GLTranEnq.Select() 中的 GLTranR tran) { if (tran.Selected == true) { transactions.Add(tran); } } 但你的解决方案更优雅,非常感谢。 “Asc
  • 为什么还要使用 searchAll 而不是 search 呢?
  • Search只会检索符合指定条件的top数据记录,SearchAll会检索所有记录。
猜你喜欢
  • 1970-01-01
  • 2011-02-13
  • 2017-05-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-26
相关资源
最近更新 更多