【问题标题】:How can I force a field to be enabled on the Bills and Adjustments screen's Document Details grid如何强制在账单和调整屏幕的文档详细信息网格上启用字段
【发布时间】:2021-12-27 23:48:54
【问题描述】:

我目前正在尝试强制在 RowSelected 事件上启用一个字段,我之前已经开始工作,但现在没有。

当帐单处于禁用网格的状态时,我添加了两个希望保持启用状态的用户字段。

我正在使用的代码是这样的,我认为它可以工作:

    protected virtual void APTran_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
    {
        var aptran = e.Row as APTran;
        if (aptran != null)
        {
            PXUIFieldAttribute.SetEnabled<APTranExt.usrGrantID>(cache, aptran, true);
            PXUIFieldAttribute.SetEnabled<APTranExt.usrReimbursementPeriod>(cache, aptran, true);
        }
    }

但它不起作用。

有什么想法吗?

谢谢...

【问题讨论】:

    标签: acumatica


    【解决方案1】:

    最有可能发生的事情是视图当前将允许更新设置为 false,这会覆盖您设置的启用状态。绕过此问题的一种方法是,对于该状态,您将允许更新设置为 true。然后强制禁用整个网格,除了您想要的两个字段。示例如下:

    protect virtual void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
    {
        if (e.Row is APinvoice row)
        {
            if (status)
            {
                Transactions.Cache.AllowUpdate = true
                PXUIFieldAttribute.SetEnabled(Transactions.Cache, null, false);
                PXUIFieldAttribute.SetEnabled<APTranExt.usrGrantID>(Transactions.Cache, null, true);
                PXUIFieldAttribute.SetEnabled<APTranExt.usrReimbursementPeriod>(Transactions.Cache, null, true);
            }
        }
    }
    

    【讨论】:

    • 我在另一个例子中看到过——所以我想我必须根据状态设置allowupdate——有点复制现有的业务逻辑。非常感谢,让克劳德! ;D
    猜你喜欢
    • 2016-10-22
    • 1970-01-01
    • 1970-01-01
    • 2018-12-08
    • 2020-10-15
    • 2020-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多