我希望在单击按钮时运行验证,如果验证通过,还将关闭智能面板。有没有办法以编程方式关闭智能面板?
发布于 2019-06-27 20:20:10
首先,在SmartPanel上,你需要添加一个按钮,并将“对话框结果”属性设置为"OK“值。
DialogResult="OK" px:PXButton runat=“
”ID="OkButton“Text="Ok”服务器
其次-你可以使用下面的代码(它是由stackOverflow编辑器编写的,但你可能理解ideea)
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;
}
}
https://stackoverflow.com/questions/55051024
复制相似问题