Acumatica-FieldUpdated-选中/取消选中复选框时启用/禁用另一个控件 [英] Acumatica - FieldUpdated - Enable / Disable another control when a checkbox is ticked / un-ticked
问题描述
我有两个自定义字段,一个是复选框,另一个是文本框,我想在更改复选框值时更改启用/禁用屏幕上的文本字段,我在FieldUpdated上添加了一个事件处理程序boolean复选框控件的事件,并获得以下代码:
I have two custom fields, one is a tickbox, and the other is a text box, I wanted to change enabled/disable the text field on the screen when the tickbox value is changed, I added an event handler on the FieldUpdated event for the boolean checkbox control, and got the following code:
protected void CROpportunity_MyCheckbox_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
var row = (CROpportunity)e.Row;
}
我可以如何在这种情况下访问其他控件?
Can I, and how to access other controls from this context?
我想我需要在复选框上启用CommitChanges。
I guess I need to enable CommitChanges on the checkbox which I did.
谢谢
推荐答案
您应使用 RowSelected
事件处理程序来启用/禁用控件。
以下是如何执行此操作的示例:
You should use RowSelected
event handler for enabling/disabling controls.
Here is an example of how you can do that:
protected virtual void CROpportunity_RowSelected(PXCache sender, PXRowSelectedEventArgs e,PXRowSelected baseMethod)
{
baseMethod?.Invoke(sender, e);
if(e.Row is CROpportunity row)
{
CROpportunityExt rowExt = PXCache<CROpportunity>.GetExtension<CROpportunityExt>(row);
PXUIFieldAttribute.SetEnabled<CROpportunityExt.myTextField>(cache,row,rowExt.MyCheckbox==true)
}
}
这篇关于Acumatica-FieldUpdated-选中/取消选中复选框时启用/禁用另一个控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!