问题
Add custom feature checkbox is not showing in custom feature UI, My finding
var featureAttributes = cache.GetAttributes(null, field).OfType<FeatureAttribute>();
giving 0 featureAttributes, that's-why it is not visible while i have added Features.xml file with proper tag as suggested in documentation, any thing else am i missing?
回答1:
All you should need is the table extension for the FeatureSet table. Here is an example:
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
}
I end up with the following:
You will create a Feature.xml file to then limit pages related to the new feature switch.
If you need to access the switch (which might not register until added into the features.xml):
PXAccess.FeatureInstalled<FeaturesSetExtension.usrMyNewFeature>()
回答2:
- Feature.XML should be in root of our Project.
- Attribute [Feature(false, DisplayName = "MY NEW FEATURE")], should always be there.
If want to see "MY NEW FEATURE" under a root then look at below code.
region UsrMyNewFeature
public abstract class usrMyNewModuleFeature : PX.Data.BQL.BqlBool.Field { }
[Feature(false, DisplayName = "MY Module FEATURE")] public bool? UsrMyNewModuleFeature { get; set; }
endregion
region UsrMyNewFeature
public abstract class usrMyNewFeature : PX.Data.BQL.BqlBool.Field { }
[Feature(false, typeof(usrMyNewModuleFeature), DisplayName = "MY NEW FEATURE")] public bool? UsrMyNewFeature { get; set; }
endregion
来源:https://stackoverflow.com/questions/61212354/feature-xml-changes-are-not-showing-in-enable-disable-custom-feature-ui