acumatica - 如何强制在账单和调整屏幕的文档详细信息网格上启用字段
问题描述
我目前正试图强制在 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);
}
}
但它不起作用。
有任何想法吗?
谢谢...
解决方案
最有可能发生的事情是视图当前将允许更新设置为 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);
}
}
}
推荐阅读
- python - 我在 python 3.9 中排序有问题
- visual-studio-code - 全新安装后绿色播放图标消失
- python - DataTimeIndex 到 ISO 8601 字符串
- clojure - 为什么`into` a map (`(into {} ,,,)`) 在 Clojure 中适用于 `vectors` 但不适用于 `lists`?
- c - 是否可以查看已编译 C 程序的宏?
- python - 使用一组迭代步骤迭代基于列表的列表
- javascript - 关闭或隐藏 iframe
- python - Python 的 multiprocessing.shared_memory.SharedMemory.close 是否必要(在这种情况下)?
- node.js - “预期未定义为 GraphQL 类型”的含义?
- assembly - 为什么“向未声明的段发送代码或数据”?