如何扩展Acumatica中Multi-selector的可选值上限至50个?
扩展Acumatica Multi-selector的选择值上限
要将Multi-selector的可选择值上限从10扩展到50,需要从两个核心维度修改:
1. 配置ASPX控件的选择上限
在PXMultiSelector控件中添加MaxSelectedItems="50"属性,直接指定允许选择的最大条目数:
修改后的ASPX代码:
<px:PXMultiSelector ID="edLocationID" runat="server" DataField="LocationID" AutoRefresh="True" AllowCustomItems="true" CommitChanges="True" MaxSelectedItems="50"> </px:PXMultiSelector>
2. 扩大数据库字段的存储容量
Multi-selector的选中值以逗号分隔的字符串形式存储,原字段255字符的长度无法容纳50个LocationCD值(按每个LocationCD平均10字符计算,50个值加逗号需约550字符)。需将C#中的PXDBString长度调整为更大的值,比如1000:
修改后的C#代码:
#region LocationID [PXDBString(1000, IsUnicode = true)] [PXSelector(typeof(Search<Location.locationCD, Where<Location.bAccountID, Equal<Current<MAADSupplierRebates.customerID>>, And<Location.status, Equal<LocationStatus.active>>>>), typeof(Location.locationCD), typeof(Location.descr), ValidateValue = false)] [PXUIField(DisplayName = MAADMessages.Project, Required = true)] [PXDefault(PersistingCheck = PXPersistingCheck.NullOrBlank)] public virtual string LocationID { get; set; } public abstract class locationID : BqlString.Field<locationID> { } #endregion
额外注意
- 若启用
AllowCustomItems="true",自定义输入的内容也会占用字段长度,需根据实际场景进一步调整PXDBString的长度,避免存储截断 - 若系统中LocationCD的平均长度较长,可继续增大字段长度值,确保完全覆盖存储需求
内容的提问来源于stack exchange,提问作者Madel Corvera
相关产品推荐
相关产品推荐

