You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Acumatica:使用PXSelectReadonly2后如何启用特定字段编辑?

解决Smart Panel弹窗中POLine Selected复选框无法勾选的问题

问题根源

你用PXSelectReadonly2定义的视图是只读视图,该视图对应的DAC数据处于不可编辑状态——即使是Selected复选框这类字段,如果是绑定到POLine的数据库字段(或扩展的绑定字段),也无法修改。如果是未绑定字段,还需要确保网格配置允许编辑。

解决方案

下面提供两种可行的解决路径,根据你的需求选择:


路径1:改用可读写视图(适用于需要修改PO相关数据的场景)

将PXSelectReadonly2替换为PXSelect2,去掉只读限制,这样就能正常编辑Selected字段:

// 替换原只读视图定义
public PXSelect2<POLine,
    InnerJoin<POOrder, On<POOrder.orderType, Equal<POLine.orderType>,
        And<POOrder.orderNbr, Equal<POLine.orderNbr>>>>,
    Where<POOrder.orderType, Equal<Current<MyCustomDAC.orderType>>,
        And<POOrder.orderNbr, Equal<Current<MyCustomDAC.orderNbr>>>>> POItems;

同时检查Smart Panel内的网格属性:

  • 确保网格的AllowEdit属性设为True
  • 确保Selected列的Editable属性设为True

路径2:使用未绑定的Selected字段(适用于无需修改原PO数据的场景)

如果不想修改原PO数据,推荐给POLine添加未绑定的Selected字段(不关联数据库),即使是只读视图也能修改这类字段:

  1. 扩展POLine DAC,添加未绑定字段:
public class POLineExt : PXCacheExtension<POLine>
{
    #region Selected
    public abstract class selected : PX.Data.BQL.BqlBool.Field<selected> { }
    [PXBool]
    [PXUIField(DisplayName = "Selected")]
    public virtual bool? Selected { get; set; }
    #endregion
}
  1. 在ASPX的网格中添加该字段,并设置可编辑:
<px:PXGrid ID="gridPOItems" runat="server" DataSourceID="ds" SkinID="Primary" AllowEdit="True">
    <Levels>
        <px:PXGridLevel DataMember="POItems">
            <Columns>
                <px:PXGridColumn DataField="Selected" Editable="True" Width="50px" />
                <!-- 其他列 -->
            </Columns>
        </px:PXGridLevel>
    </Levels>
</px:PXGrid>
  1. 保留原PXSelectReadonly2视图即可,未绑定字段不受只读视图的编辑限制。

额外检查点

  • 确认弹窗的AutoCallBack配置正确,确保选择操作能触发后台逻辑
  • 如果之前写了事件处理方法,检查是否误将Selected字段设为只读,或在事件中覆盖了勾选状态

内容的提问来源于stack exchange,提问作者Oshada Rodrigo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 15:43:25