acumatica - 我可以以编程方式关闭智能面板吗?
问题描述
我想在单击按钮时运行验证,如果验证通过,也会关闭智能面板。有没有办法以编程方式关闭智能面板?
解决方案
首先 - 在 SmartPanel 上,您需要添加一个按钮并将属性“对话结果”设置为“确定”值。
px:PXButton runat="server" ID="OkButton" Text="Ok" DialogResult="OK"
第二 - 你可以使用下面的代码(它是用stackOverflow编辑器编写的,但你可能理解这个想法)
public partial class ARInvoiceEntrySnrExt : PXGraphExtension<ARInvoiceEntry>
{
public PXAction<ARInvoice> paySmartPanelAction
[PXUIField(DisplayName = "Payment details", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual IEnumerable PaySmartPanelAction(PXAdapter adapter)
{
WebDialogResult result = this.SmartPanelDataView.AskExt();
if (result == WebDialogResult.OK)
{
var isValid = this.ValidateSmartPanelFields() //validation method everithing you may need
if (isValid == false)
{
throw new PXArgumentException(CstAPMessages.InvalidDetails, (Exception)null);
}
}
}
public virtual bool ValidateSmartPanelFields()
{
bool isValid = true;
foreach (DataViewDetail detail in this.SmartPanelDataView.Select())
{
if (detail.FieldName <= 0)
{
cache.RaiseExceptionHandling<DataViewDetail.fieldName>(detail, detail.FieldName, new PXSetPropertyException(CstAPMessages.AmountPaidMustBeGreater));
isValid = false;
}
}
return isValid;
}
}
推荐阅读
- android - 没有原生活动样本的聚合帧统计信息
- git - 从旧遥控器获取纱线安装
- tcl - 如何从 TCL Proc 返回列表?
- ruby-on-rails - RSpec API 控制器测试
- javascript - 更改页面 div 中的文本
- multithreading - FFmpeg 用 avcodec_send_packet() 做什么?
- sql-server - 在 SQL Server 中生成自动序列为 AB001...AB999
- javascript - 无法解析返回的 Jquery/.NET Core JSON
- javascript - 用于播放和暂停视频的 Javascript 函数
- c++ - 将函数指针成员模板限制为仅派生类