【发布时间】:2020-04-14 16:14:55
【问题描述】:
添加自定义功能复选框未显示在自定义功能 UI 中,我的发现
var featureAttributes = cache.GetAttributes(null, field).OfType<FeatureAttribute>();
给出 0 个 featureAttributes,这就是为什么当我按照文档中的建议添加带有适当标签的 Features.xml 文件时它不可见,我还缺少什么吗?
【问题讨论】:
添加自定义功能复选框未显示在自定义功能 UI 中,我的发现
var featureAttributes = cache.GetAttributes(null, field).OfType<FeatureAttribute>();
给出 0 个 featureAttributes,这就是为什么当我按照文档中的建议添加带有适当标签的 Features.xml 文件时它不可见,我还缺少什么吗?
【问题讨论】:
您所需要的只是 FeatureSet 表的表扩展。这是一个例子:
public sealed class FeaturesSetExtension : PXCacheExtension<PX.Objects.CS.FeaturesSet>
{
#region UsrMyNewFeature
public abstract class usrMyNewFeature : PX.Data.BQL.BqlBool.Field<usrMyNewFeature> { }
[Feature(false, DisplayName = "MY NEW FEATURE")]
public bool? UsrMyNewFeature { get; set; }
#endregion
}
我最终得到以下结果:
您将创建一个 Feature.xml 文件,然后限制与新功能切换相关的页面。
如果您需要访问开关(在添加到 features.xml 之前可能不会注册):
PXAccess.FeatureInstalled<FeaturesSetExtension.usrMyNewFeature>()
【讨论】:
如果想在根目录下查看“我的新功能”,请查看 下面的代码。
公共抽象类 usrMyNewModuleFeature : PX.Data.BQL.BqlBool.Field { }
[Feature(false, DisplayName = "我的模块功能")] 公共布尔? UsrMyNewModuleFeature { 获取;放; }
公共抽象类 usrMyNewFeature : PX.Data.BQL.BqlBool.Field { }
[Feature(false, typeof(usrMyNewModuleFeature), DisplayName = "我的新功能")] 公共布尔? UsrMyNewFeature { 获取;放; }
【讨论】: