我想在网格中选择一行时启用或禁用按钮,这是我现在尝试的内容:
public virtual void ARRegister_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
ARRegister row = e.Row as ARRegister;
if (row == null) return;
UnProcessLettering.SetEnabled(row.GetExtension<ARRegisterLeExt>().LettrageCD != null);
}
我在网格中将syncposition设置为true . 但是当我选择LettrageCD不为null或为null的行时,没有任何变化 .
编辑:似乎我的问题是重复:Is there any event triggered when highlighting a row?(在我的第一次搜索中找不到它:()
1 回答
不要在PXAction上调用SetEnabled,而是使用按钮aspx声明中的StateColumn属性 .
声明按钮时,指定一个布尔DAC字段,该字段将根据其值启用/禁用该按钮 . 请注意,该按钮需要将DependOnGrid属性设置为网格的ID才能获取所选行:
IsButtonVisible是一个自定义的未绑定布尔DAC字段:
您可以根据业务逻辑在RowSelected事件中设置IsButtonVisible的值:
资料来源:Enable disable button of grid or PXToolBarButton, which depends from value of column in Acumatica