Acumatica 在 PXView 中设置特定列/单元格的样式?
我对 Acumatica 编码非常陌生。我正在尝试更改 AR303000 标题页上单元格的颜色。 (参见下面的代码)。显然这是行不通的。我收到错误消息 PXFormViewEventArgs 在命名空间 PX.Web.UI 中不存在。
谁能指导我应该使用哪个命名空间并更正我的代码以使其工作? 谢谢你,
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using PX.Common;
using PX.Data;
using PX.SM;
using PX.Objects.AR.CCPaymentProcessing;
using PX.Objects.AR.Repositories;
using PX.Objects.Common;
using PX.Objects.Common.Discount;
using PX.Objects.CA;
using PX.Objects.CM;
using PX.Objects.CR;
using PX.Objects.CR.Extensions;
using PX.Objects.CS;
using PX.Objects.SO;
using PX.Objects.AR.CCPaymentProcessing.Helpers;
using PX.Data.BQL.Fluent;
using PX.Data.BQL;
using PX.Data.Descriptor;
using CashAccountAttribute = PX.Objects.GL.CashAccountAttribute;
using PX.Objects.GL.Helpers;
using PX.Objects.TX;
using PX.Objects.IN;
using PX.Objects.CR.Extensions.Relational;
using PX.Objects.CR.Extensions.CRCreateActions;
using PX.Objects.GDPR;
using PX.Objects.GraphExtensions.ExtendBAccount;
using PX.Data.ReferentialIntegrity.Attributes;
using CRLocation = PX.Objects.CR.Standalone.Location;
using PX.Objects;
using PX.Objects.AR;
namespace PX.Objects.AR
{
public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint>
{
protected void Page_Load(object sender, EventArgs e)
{
Style escalated = new Style();
escalated.ForeColor = System.Drawing.Color.Red;
this.Page.Header.StyleSheet.CreateStyleRule(escalated, this, ".CssEscalated");
Style rowStyle = new Style();
rowStyle.BackColor = System.Drawing.Color.Red;
this.Page.Header.StyleSheet.CreateStyleRule(rowStyle, this, ".CssRowStyle");
Style cellStyle = new Style();
cellStyle.BackColor = System.Drawing.Color.Aqua;
this.Page.Header.StyleSheet.CreateStyleRule(cellStyle, this, ".CssCellStyle");
Style highlightStyle = new Style();
highlightStyle.BackColor = System.Drawing.Color.Yellow;
this.Page.Header.StyleSheet.CreateStyleRule(highlightStyle, this, ".CssHighlightStyle");
}
protected void Customer_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PX.Web.UI.PXFormViewEventArgs f)
{
var customer = (CR.BAccount)e.Row;
var customerExt = customer.GetExtension<CR.BAccountExt>();
if (customerExt != null)
{
/*I want to change the color of this cell in the form*/
customerExt.UsrReadOnlyAcctName = customer.AcctName;
}
}
#region Event Handlers
#endregion
}
}```
I am VERY new to Acumatica in coding. I am trying to change the color of a cell on the header page of AR303000. (see code below). Obviously this is not working. I receive the error message of PXFormViewEventArgs does not exist in the namespace PX.Web.UI.
Can anyone direct me as to what namespace I should be using and correct my code to make this work?
Thank you,
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using PX.Common;
using PX.Data;
using PX.SM;
using PX.Objects.AR.CCPaymentProcessing;
using PX.Objects.AR.Repositories;
using PX.Objects.Common;
using PX.Objects.Common.Discount;
using PX.Objects.CA;
using PX.Objects.CM;
using PX.Objects.CR;
using PX.Objects.CR.Extensions;
using PX.Objects.CS;
using PX.Objects.SO;
using PX.Objects.AR.CCPaymentProcessing.Helpers;
using PX.Data.BQL.Fluent;
using PX.Data.BQL;
using PX.Data.Descriptor;
using CashAccountAttribute = PX.Objects.GL.CashAccountAttribute;
using PX.Objects.GL.Helpers;
using PX.Objects.TX;
using PX.Objects.IN;
using PX.Objects.CR.Extensions.Relational;
using PX.Objects.CR.Extensions.CRCreateActions;
using PX.Objects.GDPR;
using PX.Objects.GraphExtensions.ExtendBAccount;
using PX.Data.ReferentialIntegrity.Attributes;
using CRLocation = PX.Objects.CR.Standalone.Location;
using PX.Objects;
using PX.Objects.AR;
namespace PX.Objects.AR
{
public class CustomerMaint_Extension : PXGraphExtension<CustomerMaint>
{
protected void Page_Load(object sender, EventArgs e)
{
Style escalated = new Style();
escalated.ForeColor = System.Drawing.Color.Red;
this.Page.Header.StyleSheet.CreateStyleRule(escalated, this, ".CssEscalated");
Style rowStyle = new Style();
rowStyle.BackColor = System.Drawing.Color.Red;
this.Page.Header.StyleSheet.CreateStyleRule(rowStyle, this, ".CssRowStyle");
Style cellStyle = new Style();
cellStyle.BackColor = System.Drawing.Color.Aqua;
this.Page.Header.StyleSheet.CreateStyleRule(cellStyle, this, ".CssCellStyle");
Style highlightStyle = new Style();
highlightStyle.BackColor = System.Drawing.Color.Yellow;
this.Page.Header.StyleSheet.CreateStyleRule(highlightStyle, this, ".CssHighlightStyle");
}
protected void Customer_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PX.Web.UI.PXFormViewEventArgs f)
{
var customer = (CR.BAccount)e.Row;
var customerExt = customer.GetExtension<CR.BAccountExt>();
if (customerExt != null)
{
/*I want to change the color of this cell in the form*/
customerExt.UsrReadOnlyAcctName = customer.AcctName;
}
}
#region Event Handlers
#endregion
}
}```
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你可以检测Form和UsrReadonlyAcctName的控件,然后在Page_Load期间应用Css样式;下面是一个示例,但就我而言,我找到一个网格,然后在 RowDataBound 期间检测单元格的值:
Patrick Chen 提供了有用的参考。
编辑答案:
下面是销售订单页面 SO301000 上的示例,该示例查找“客户订单编号”文本框并在其文本为空时添加颜色:
I think you can detect the Form and the control of the UsrReadonlyAcctName and then apply the Css style during Page_Load; below is an example, but in my case, I find a Grid and then detect a Cell's value during RowDataBound:
Patrick Chen supplies a helpful reference.
EDIT ANSWER:
Below is an example on the Sales Order page SO301000 that finds the "Customer Order Nbr" TextBox and adds color when its Text is empty: