如何修改Acumatica数据网格中Note Text字段的列标题为Internal Comment?
解决方案:修改Note Text字段的列标题为Internal Comment
方法1:通过CacheAttached事件修改字段显示名
由于Note.noteText字段由PXNoteAttribute动态添加,可利用CacheAttached事件覆盖其UI显示属性,这是Acumatica中修改动态添加字段属性的标准方式:
public class TargetGraphExtension : PXGraphExtension<TargetBaseGraph> { [PXMergeAttributes(Method = MergeMethod.Merge)] [PXUIField(DisplayName = "Internal Comment")] public void _(Events.CacheAttached<Note.noteText> e) { } }
PXMergeAttributes确保原有属性被保留,仅合并新的PXUIField设置- 该事件会在
Note缓存初始化字段时触发,全局生效
方法2:直接在ASPX页面指定列标题
如果仅需在特定页面的网格中修改,可直接在GridView的列配置中设置HeaderText:
<px:PXGridColumn DataField="NoteText" HeaderText="Internal Comment" />
这种方式无需编写C#代码,仅针对当前页面生效,适合页面级自定义
为什么之前的RowSelected代码无效
RowSelected事件是行选择触发的逻辑,字段的显示名属于缓存元数据,需要在缓存初始化阶段设置,而非行选择时。CacheAttached才是修改字段元数据的正确时机。
内容的提问来源于stack exchange,提问作者Grahame Price
相关产品推荐
相关产品推荐

